Make Prelude's map = fmap
Henning Thielemann
lemming at henning-thielemann.de
Sun Jun 23 19:46:40 CEST 2013
On Fri, 21 Jun 2013, Matthias Kilian wrote:
> On Fri, Jun 21, 2013 at 04:53:49PM -0400, Carter Schonwald wrote:
>> I'd support the map=fmap thing,
>
> Does it cause any consequences for existing libraries and programs?
> Does it break any existing Haskell98 (or Haskell2010) code?
>
> If not: fine. But if yes: please don't do it.
My main concern is that we reduce type-safety. If you have a lot of nested
Functors, and you apply a nested fmap like in (fmap (fmap (fmap f))) with
a polymorphic f, then after adding or removing a functor level the code
can probably still be compiled, but is wrong. It is also more difficult to
read, since in order to understand (fmap (fmap (fmap f))) you have to
infer types mentally, in order to find out that, say, the second fmap is a
List.map. These are my general concern with always using the most general
function available.
Thus a -1 for this proposal, from me.
More information about the Libraries
mailing list