1

As far as I know, you can use fmap in place of map in all cases -- the following two are equivalent.

map (*2) [1..10]
fmap (*2) [1..10]

So, since they do the same thing, why does map even exist? Why can't fmap just be map? My guess is it's either for a historical reason, or for performance somehow.

Zac
  • 813
  • 10
  • 22
  • 1
    I suppose you could write an expression that would have ambiguous type with `fmap`, but it would probably need to be crafted for this purpose. My guess is that it is just historical. – zch Jul 24 '17 at 19:00
  • @DietrichEpp You're right - I didn't see that one. – Zac Jul 24 '17 at 19:11
  • I usually find these questions with a Google search rather than the SO search. – Dietrich Epp Jul 24 '17 at 19:55

0 Answers0