[Haskell-beginners] question about list processing

David McBride toad3k at gmail.com
Thu Nov 12 21:12:56 UTC 2015


It is mostly just things like:

Prelude.length (Data.Map.fromList [(1,"1"),(2,"2")])

Prelude.foldr (+) 0 (Data.Set.fromList [1,2,3,4,5])

Prelude.null Nothing
Prelude.null (Just 2)

Just watch out for some gotchas:

minimum (1,2)

On Thu, Nov 12, 2015 at 4:00 PM, Dennis Raddle <dennis.raddle at gmail.com>
wrote:

>
>
> On Thu, Nov 12, 2015 at 6:32 AM, David McBride <toad3k at gmail.com> wrote:
>
>> There was some real controversy over this change.  People were strongly
>> opposed to the change for exactly the reason you gave (among others), that
>> it is hard for beginners.  However, there was enough momentum that it went
>> through, and now things like fmap and length work on a wide variety of data
>> types.  You can google ftp haskell controversy for more info.
>>
>>
>
>
>
> Thanks, David. As far as instances of Functor, Applicative, and Monad, so
> far I've mostly used lists and Maybe. I've never taken specific advantage
> of Traversable.
>
> Could you suggest a new type for me to explore? I mean something that
> could have instances in any of the above classes, one or all.
>
> I only use Haskell for an occasional hobby project so despite having
> started five years ago, I consider myself a beginner. My project involves
> playing music by transforming a musical score into MIDI commands and
> sending them to a software synthesizer. As far as library types, I mostly
> use Map, lists, and Maybe. These are all I have needed to look for patterns
> in lists or Maps of notes. But I'm sure I'm missing out on something.
>
> 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/5c652b30/attachment.html>


More information about the Beginners mailing list