
21 Mar
2005
21 Mar
'05
10:09 a.m.
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/