[Haskell-cafe] Issues(Bugs?) with GHC Type Families

Manuel M T Chakravarty chak at cse.unsw.edu.au
Thu Mar 6 19:55:16 EST 2008


Hugo Pacheco:
> Just something I have been wondering.
>
> I would like to implement somehting like:
>
> type family F a :: * -> *
> ...
> class C a b where ...
> instance (F a ~ F b) => C a b where ...
>
> But apparently type equality coercions can not be used as a single  
> context. If I enable -fallow-undecidable-instances, whenever the  
> equality does not hold, the instance returns a compile error, what  
> does make sense.
>
> Is there any way I could overcome this?

I think I don't understand your question fully.  This class instance  
requires both -XFlexibleInstances and -fallow-undecidable-instances to  
compile.

If the equality does not hold, you should get a type error because  
your program is not type correct.  So, what is it that you would like  
different?

Manuel



More information about the Haskell-Cafe mailing list