[Haskell-cafe] tuple and HList

Frederik Eaton frederik at a5.repetae.net
Mon Mar 21 05:09:03 EST 2005


> You need to swap the arguments to TCons...
> 
> data TCons l a = TCons !l a
> 
> Then:
> 
> instance Functor (TCons (TCons HNil a)) where
>    fmap f (TCons (TCons HNil x) y) = TCons (TCons HNil (f x)) y)

How does one solve this problem in general, i.e. when the arguments to
a type are in the wrong order for an instance that one wants to
declare? Someone on the haskell IRC channel mentioned that if you
could derive instances for partially applied type synonyms then one
could just make a dummy synonym with the arguments in the right order,
but that doesn't appear to be premitted. The other question is why
isn't it permitted.

Frederik

-- 
http://ofb.net/~frederik/


More information about the Haskell-Cafe mailing list