[Haskell-cafe] Problems with type families

Silvio Frischknecht silvio.frischi at gmail.com
Mon Jul 6 23:29:30 UTC 2015

looks like the problem are the 'e's. you can see it from

Could not deduce (TFunOut t1 e ~ TFunOut t1 e0)

the e0 comes from the output of TFunIn/TFunOut and the instance does not
know that it is the same as the e variable you use.

I don't know exactly what your program does. but if e is just a
phantom/security parameter you can do it like this.

type family TFunIn t :: * -> *

type instance TFunIn  IdT = Signal

type instance TFunIn  (ComposeT t1 t2) = TFunIn  t2

instance (SignalT t1 e, SignalT t2 e, TFunOut t2 ~ TFunIn t1)
    => SignalT (ComposeT t1 t2) e where
        transform _ x = (transform (undefined :: t1) .
                         transform (undefined :: t2)) x

Otherwise you will have to find a way to prove that the 'e's are the same

Cheers Silvio

More information about the Haskell-Cafe mailing list