
Speaking of lists and history, I noticed that a lot of library functions
which were formerly defined over lists (when I first looked at Haskell six
years ago) are now defined on Traversable, which makes it a lot harder for
beginners to read the documentation. I have been playing with Haskell for
five years, but not much, so I'm still a beginner. I just mentally
substitute lists when I see Traversable.
I only really use lists and Maybe, as far as instances of the typeclasses
go. That's only two types, but a lot to learn!
D
On Thu, Nov 12, 2015 at 5:42 AM, akash g
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
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
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@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
_______________________________________________ Beginners mailing list Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners