Send Beginners mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."
Today's Topics:
1. Alternative (Imants Cekusins)
2. Re: Alternative (Oliver Charles)
----------------------------------------------------------------------
Message: 1
Date: Wed, 28 Dec 2016 11:55:06 +0100
From: Imants Cekusins <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: [Haskell-beginners] Alternative
Message-ID:
<cap1qinarhu776do9ff7swtekvvi45dyokpskzgkxt8d0jhh...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
discovered this handy snippet today (duh :):
>>> foldl (<|>) Nothing [Nothing, Just 1, Nothing, Just 2]
Just 1
basically, pick first Just from a list of Maybes
http://hackage.haskell.org/package/base-4.9.0.0/docs/Control-Applicative.html#g:2
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://mail.haskell.org/pipermail/beginners/attachments/20161228/0b8f62ce/attachment-0001.html>
------------------------------
Message: 2
Date: Wed, 28 Dec 2016 12:10:29 +0000
From: Oliver Charles <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Alternative
Message-ID:
<cagrp5rmksgape-pg4e2jvygttdvuu700ovezrrarnx9ggj2...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
If you want something even simpler:
asum [Nothing, Just True, Nothing, Just False]
>From Data.Foldable :)
On Wed, 28 Dec 2016, 10:56 am Imants Cekusins, <[email protected]> wrote:
> discovered this handy snippet today (duh :):
>
> >>> foldl (<|>) Nothing [Nothing, Just 1, Nothing, Just 2]
> Just 1
>
> basically, pick first Just from a list of Maybes
>
>
>
> http://hackage.haskell.org/package/base-4.9.0.0/docs/Control-Applicative.html#g:2
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://mail.haskell.org/pipermail/beginners/attachments/20161228/e8f7f512/attachment-0001.html>
------------------------------
Subject: Digest Footer
_______________________________________________
Beginners mailing list
[email protected]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
------------------------------
End of Beginners Digest, Vol 102, Issue 17
******************************************