[Haskell-beginners] a simple little problem

Brandon Allbery allbery.b at gmail.com
Sat Aug 13 20:47:04 CEST 2011


On Sat, Aug 13, 2011 at 14:04, Dennis Raddle <dennis.raddle at gmail.com>wrote:

> Can someone suggest an elegant way to write the following?
>
> fn :: [Maybe Float] -> Maybe Float
>
> in which, if the input list has all Nothing, then the result is Nothing
> if the input list has one or more Just x, then the result is Just x
> (in which the x is picked arbitrarily, could be the first one or last
> one)
>

Isn't this just mconcat?

-- 
brandon s allbery                                      allbery.b at gmail.com
wandering unix systems administrator (available)     (412) 475-9364 vm/sms
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20110813/51456ae6/attachment.htm>


More information about the Beginners mailing list