Polymorphism in the Prelude

Henning Thielemann schlepptop at henning-thielemann.de
Mon Aug 11 11:12:25 UTC 2014


Am 11.08.2014 um 12:24 schrieb Oliver Charles:
> 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.

I'd prefer to be able to read such code without the help of an editor. E.g.

    map (Map.map (Maybe.map (map f)))

makes everything obvious without any tool.



More information about the Libraries mailing list