[Haskell-cafe] translating from fundeps into type families

Chaddaï Fouché chaddai.fouche at gmail.com
Tue Apr 8 05:29:44 EDT 2008


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 ?

-- 
Jedaï


More information about the Haskell-Cafe mailing list