[Haskell-cafe] A function for Maybes (RESOLVED)
John Ky
newhoggy at gmail.com
Thu Jan 25 20:47:37 EST 2007
Thanks
-John
On 1/26/07, Brandon S. Allbery KF8NH <allbery at ece.cmu.edu> wrote:
>
>
> On Jan 25, 2007, at 9:15 , John Ky wrote:
>
> > Is there a built-in function that already does this?
> >
> > foo :: (a -> b) -> Maybe a -> Maybe b
> > foo f m
> > | isNothing m = Nothing
> > | otherwise = Just (f (fromJust m))
>
> Nothing specific to Maybe, because the more general liftM (over
> monads) or fmap (over functors) already does it.
>
> --
> brandon s. allbery [linux,solaris,freebsd,perl] allbery at kf8nh.com
> system administrator [openafs,heimdal,too many hats] allbery at ece.cmu.edu
> electrical and computer engineering, carnegie mellon university KF8NH
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20070126/1a0284e0/attachment.htm
More information about the Haskell-Cafe
mailing list