[Haskell-cafe] [Maybe Int] sans Nothings

Malcolm Wallace malcolm.wallace at me.com
Mon May 23 18:35:26 CEST 2011


On 23 May 2011, at 17:20, michael rice wrote:

> What's the best way to end up with a list composed of only the Just values,
> no Nothings?

Alternatively,

    [ x      | Just x <- originals ]

It also occurs to me that perhaps you still want the Just constructors.

    [ Just x | Just x <- originals ]
    [ x      | x@(Just _) <- originals ]




More information about the Haskell-Cafe mailing list