[Haskell-beginners] am I wording this right?
Michael P Mossey
mpm at alumni.caltech.edu
Tue Aug 4 20:25:04 EDT 2009
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
More information about the Beginners
mailing list