[Haskell-cafe] Problems with type families

Leza Morais Lutonda leza.ml at fecrd.cujae.edu.cu
Thu Jul 9 04:40:17 UTC 2015


On 07/08/2015 11:30 PM, Silvio Frischknecht wrote:
> 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)
>
I got it! This solution is nice for me, and helped me to understand how 
to tell the compiler about the `e` type.
Thank you Silvio!

-- 
Leza Morais Lutonda, Lemol-C
http://lemol.github.io



50 Aniversario de la Cujae. Inaugurada por Fidel el 2 de diciembre de 1964  http://cujae.edu.cu




More information about the Haskell-Cafe mailing list