[Haskell-cafe] Problems with type families
Silvio Frischknecht
silvio.frischi at gmail.com
Thu Jul 9 03:30:58 UTC 2015
> type instance TFunIn DoubleT e = (Signal e, Signal e)
I give up. I'm not sure it's possible to tell to the compiler that when
using transform function (the IdT version in the implementation of
ComposeT) that it should use the one with the same e. Not sure it's
possible. Anyway a workaround would be.
class SignalT t e
where
transform :: e -> t -> TFunIn t e -> TFunOut t e
instance (
SignalT t1 e,
SignalT t2 e,
TFunOut t2 e ~ TFunIn t1 e
) => SignalT (ComposeT t1 t2) e
where
transform _ _ x =
(transform (undefined :: e) (undefined :: t1))
(transform (undefined :: e) (undefined :: t2))
(x :: TFunIn (ComposeT t1 t2) e)
But you could save your self a lot of hurt by just using
newtype DoubleSignal a = DoubleSignal (Signal a, Signal a)
you could even remove the e from the SignalT class.
Silvio
More information about the Haskell-Cafe
mailing list