map and fmap

Iavor Diatchki iavor.diatchki at gmail.com
Wed Aug 23 02:28:45 EDT 2006


Hello,

On 8/22/06, John Meacham <john at repetae.net> wrote:
> I am not talking about type signatures, I am talking about having to
> annotate in the middle of a term.
>
> f x y | x `member` map g freeVars y  = ....
>
> having to become
>
> f x y | x `member` map g (freeVars y :: [Id])  = ....

There is no need to write such types... In this particular case the
type of 'elem' indicates that the argument is a list.  I don't think
that a polymorphic 'map' function requires any more signatures than,
say, '>>='.  This certainly is not my experience when I use 'fmap'...

> So, I am not saying renaming fmap to map is bad outright, I am just
> saying that the question is trickier than just the error message problem
> it was previously stated in terms of.

Do you have an example illustrating what is tricky about 'fmap'?  As
far as I understand 'map' used to be polymorphic, and later the
distinction between 'map' and 'fmap' was specifically introduced to
avoid the error messages that may confuse beginners.

-Iavor


More information about the Haskell-prime mailing list