[Haskell-cafe] Type synonym family inside type class

Sean Leather leather at cs.uu.nl
Fri Nov 27 08:53:34 EST 2009


> I have a type family and a type class:
>
>  type family ErrorAlg (f :: (* -> *) -> * -> *) e ix :: *
>>
>
>  class MkErrorAlg f where
>>  mkErrorAlg :: ErrorAlg f e a -> f (K0 a) ix -> Either e a
>>
>
> Instances for these two really go hand in hand, so I thought I would move
> the type family into the type class.


Perhaps this isn't answering your question, but you can turn the above into
an associated type as follows.

class MkErrorAlg f where
>   type ErrorAlg (f :: (* -> *) -> * -> *) :: * -> * -> *
>   mkErrorAlg :: ErrorAlg f e a -> f (K0 a) ix -> Either e a
>

Regards,
Sean
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20091127/4c075e3f/attachment.html


More information about the Haskell-Cafe mailing list