
On Tue, Jun 5, 2012 at 2:25 PM, Gábor Lehel
The encoded version would be:
instance (f a b) => FMap f (HJust a) (HJust b) where type f :<$>: (HJust a) = HJust b
and I think this actually demonstrates a *different* limitation, namely that
The RHS of an associated type declaration mentions type variable `b' All such variables must be bound on the LHS
which means that the standard encoding doesn't work for this case.
From a reddit comment[1] by Reiner Pope it turns out you can actually do this:
instance (f a b) => FMap f (HJust a) (HJust b) where type f :<$>: (HJust a) = HJust (f :<$>: a) A bit more awkward to write, but we're back to TFs not having any expressivity problem in this department. [1] http://www.reddit.com/r/haskell/comments/ut85i/a_few_typefamilies_nuggets/c4...