map and fmap

Aaron Denney wnoise at ofb.net
Fri Aug 18 12:32:23 EDT 2006


On 2006-08-18, John Hughes <rjmh at cs.chalmers.se> wrote:
> Jon Fairbairn <jon.fairbairn at cl.cam.ac.uk>
>> A reasonable choice (forestalling the objection that using
>> List.map, listMap or mapList would be too distracting for
>> students) would be
>>
>>   lmap:: (t -> t') -> [t] -> [t']
>>   map:: Functor f => (t -> t') -> f t -> f t'
>>
>
> I'd prefer mapList to lmap, to be honest--at least the connection between 
> the name
> and the type is clear. But remember, this would at a stroke make Haskell'
> incompatible with all existing Haskell textbooks. Even if publishers brought
> out new editions, even if we told students to buy them, there are many, many
> second hand books in circulation, and it would be years before one could 
> rely
> on students having Haskell' books. All that time, students would write map
> instead of mapList because that's what the book says, and get stuck with
> incomprehensible error messages. Is it really worth an incompatible change
> in the library functions used by all beginners, just to rename fmap to map?
> It seems to me that the gain from a change is very small, and the cost 
> considerable.

But list is a functor, so it should work.  They just get harder error
messages, when their programs are wrong.  Let's work on the error messages,
not keeping the language harder to understand for more general programs.

-- 
Aaron Denney
-><-



More information about the Haskell-prime mailing list