[Haskell-cafe] Using fundeps to resolve polymorphic types to
concrete types  wren ng thornton wren at freegeek.org Thu Jul 31
03:05:56 EDT 2008  Ryan Ingram wrote: > Hmm, I'm kind of
confused by this now.  I feel like the following code > really
should compile, but it doesn't.  There's no use of existentials
> to hide type information at all.  The functional dependency
seems like > it should give us the constraint (b1 ~ b2) allowing
Refl to typecheck.  It may be worth noting that GADTs subsume
existential types. Not that  that matters here.  >> {-# LANGUAGE
MultiParamTypeClasses, FunctionalDependencies, GADTs #-} >>
module DeriveType where >> class DeriveType a b | a -> b >> data
TypeEq a b where Refl :: TypeEq a a >> test :: (DeriveType a b1,
DeriveType a b2) => a -> TypeEq b1 b2 >> test _ = Refl > But...
> derivetype.hs:8:9: >     Couldn't match expected type `b1'
against inferred type `b2'  Like I was saying, contexts are only
ever verified as constraints on  polymorphism, they never drive
the type inferen