[Haskell-beginners] question about list processing
dennis.raddle at gmail.com
Thu Nov 12 13:48:46 UTC 2015
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!
On Thu, Nov 12, 2015 at 5:42 AM, akash g <akaberto at gmail.com> wrote:
> 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>
>>> 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?
>>> Beginners mailing list
>>> Beginners at haskell.org
> Beginners mailing list
> Beginners at haskell.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Beginners