[Haskell-beginners] question about list processing

akash g akaberto at gmail.com
Thu Nov 12 13:42:27 UTC 2015


http://stackoverflow.com/questions/7463500/why-do-we-have-map-fmap-and-liftm
have very good answers on this.

On Thu, Nov 12, 2015 at 7:11 PM, akash g <akaberto at gmail.com> wrote:

> map is specialized for lists while fmap is for any functors.  Its presence
> is historical.  Prefer fmap over map.
>
> On Thu, Nov 12, 2015 at 7:03 PM, Dennis Raddle <dennis.raddle at gmail.com>
> wrote:
>
>> Just after I posted that question, I started driving home, and on the
>> drive I thought of your answer. I think I'm starting to ask the right
>> questions when I'm programming in Haskell. Like redundancy and bloat is a
>> sure sign that a more witty expression is available, and that I should
>> consult the typeclasses.
>>
>> Second, I am not used to the implications of laziness, so it took me a
>> while to hit on your solution because I keep thinking you have to map
>> something over the whole list, and that if you only want to map it over the
>> head, you are stuck.
>>
>> You can use 'map' also, instead of 'fmap', right? Is 'map' just 'fmap'
>> for lists?
>>
>> D
>>
>>
>> _______________________________________________
>> Beginners mailing list
>> Beginners at haskell.org
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20151112/f3c3d753/attachment.html>


More information about the Beginners mailing list