
4 Aug
2009
4 Aug
'09
8:25 p.m.
Peter Verswyvelen wrote:
Note however that the following is correct:
instance Functor ((,) a) where fmap f (x,y) = (x, f y)
and even:
instance Functor ((->) a) where fmap f g = f . g
Thanks. What's curious to me about these instances is that they have a type variable a which is never referenced in the definition. Is there ever a case in which you would refer to the type variable 'a' somewhere in the definition of an instance? I know that the types of the "member functions" of the instance are given in the class definition, so there is no place to put a type definition in the instance, I don't think. Thanks, Mike