Polymorphism in the Prelude

Oliver Charles ollie at ocharles.org.uk
Mon Aug 11 10:24:13 UTC 2014


On 10/08/14 20:26, Henning Thielemann wrote:
> I have to strongly agree. I have already written things like
>
>    fmap (fmap (fmap (fmap f)))
>
> and find it hard to find out later, which fmap refers to Maybe, which
> one to List, and which one to Map. That is, I prefer 'map' even if
> there is an 'fmap'.

But this problem comes up /anywhere/ you are composing polymorphic
functions. Just renaming functions in the case of `fmap` just solves
that particular problem, but doesn't solve the problem in the general
case. I think this is a problem that is truly solved best by editor
tools. You, the editor, need to know the type of some expression to
continue coding, so you should be able to ask your editor such a
question. Even if you can't do that now, I'm fairly convinced that you
will be able to in the future, so I don't think such problems should be
solved with code modifications - they simply don't scale (what about
mapMaybe? mapEither? mapIO?)

- ocharles
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/libraries/attachments/20140811/179f8c1d/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
URL: <http://www.haskell.org/pipermail/libraries/attachments/20140811/179f8c1d/attachment.sig>


More information about the Libraries mailing list