Polymorphism in the Prelude

Henning Thielemann schlepptop at henning-thielemann.de
Sun Aug 10 19:26:38 UTC 2014


Am 18.06.2014 um 12:09 schrieb Yitzchak Gale:

> In my opinion, Richard missed the most important reason:
>
> 3) Gratuitous polymorphism makes code much less readable
>     and much costlier to maintain, usually for almost no gain.
>
> One of the biggest strengths of Haskell is semantic clarity.
> You can often look at a Haskell expression, recognize its type,
> and then immediately understand exactly what the expression
> is doing. That is immensely valuable, not only for writing code,
> but for maintaining and refactoring it over the lifetime of an
> application, often by people other than the original author.

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'.



More information about the Libraries mailing list