[Haskell-cafe] an instance in other than the last type parameters
deb at pudlak.name
Fri Jul 17 15:14:33 EDT 2009
Hi, I have probably a very simple question, but I wasn't able to figure it out
Consider a two-parameter data type:
> data X a b = X a b
If I want to make it a functor in the last type variable (b), I can just define
> instance Functor (X a) where
> fmap f (X a b) = X a (f b)
But how do I write it if I want X to be a functor in its first type variable?
Is that possible at all?
> instance Functor ??? where
> fmap f (X a b) = X (f a) b
Thanks in advance,
More information about the Haskell-Cafe