map and fmap

John Hughes rjmh at
Tue Aug 29 01:58:58 EDT 2006

> On 8/28/06, John Hughes <rjmh at> wrote:
>> No, map was never overloaded--it was list comprehensions that were
>> overloaded as monad comprehensions in Haskell 1.4. That certainly did 
>> lead
>> to problems of exactly the sort John M is describing.
> I just checked the reports for Haskell 1.3 and 1.4 on the Haskell
> website and they both state that the method of 'Functor' was 'map'.  I
> only started using Haskell towards the end of 1.4, so I don't have
> much experience with those versions of the language, but it seems that
> having an overloaded 'map' was not much of a problem if only a few
> people noticed.
> -Iavor

Good Lord, I'd forgotten that! So I'm afraid I've also forgotten the details 
of the arguments that led to fmap being introduced--maybe others can fill 
them in. But I wouldn't conclude from that that "only a few people noticed" 
and so it would be OK to overload map again.

On the contrary, it seems we had plenty of experience with an overloaded 
map--it was in the language for two and a half years, and two language 
versions. In the light of that experience, the Haskell 98 committee 
evidently decided that overloading map was a mistake, and introduced fmap 
for the overloaded version. Now, this was an incompatible change, and the 
Haskell committee was always very wary of making such changes--so there must 
have been a weight of experience suggesting that overloading map really was 
a mistake. It wouldn't have been changed on the basis of abstract 
discussions of small examples. My own bad experiences with list overloading 
were with monad comprehensions, but others must have had bad experiences 
with overloaded map also. Given that it's been tried--and tried so 
thoroughly--and then abandoned, I would be very wary of reintroducing it.

We didn't simplify things in Haskell 98 for the sake of it--we simplified 
things because users were complaining that actually using the language had 
become too complex, that there were too many corners to stumble on. I think 
we did a good job--certainly, the Haskell community began growing 
considerably faster once Haskell 98 came out. So I'd be very nervous about 
undoing some of the simplifications we made at that time.


More information about the Haskell-prime mailing list