[Haskell-cafe] translating from fundeps into type families

Manuel M T Chakravarty chak at cse.unsw.edu.au
Tue Apr 8 22:29:19 EDT 2008


Chaddaï Fouché:
> 2008/4/8, Manuel M T Chakravarty <chak at cse.unsw.edu.au>:
>> You need to write the instance as
>>
>>  instance (b ~ TheFoo a, Foo a) => Bar (Either a b) where
>>    bar (Left a) = foo' a
>>    bar (Right b) = foo' (foo b :: a)
>>
>
> If you do that, the program compile, but res still raise a panic in  
> GHC6.8.2 .
>
> Before you sent your solution, I also tried to do
>
> class (TheFoo a ~ b) => Foo a b where ...
>
> instance (Foo a b) => Bar (Either a b) where ...
>
> But it didn't compile, it seems to me both versions should have the
> same behaviour ?

6.8.2 has many bugs concerning type families that have been removed in  
the development version of GHC.

Manuel



More information about the Haskell-Cafe mailing list