guarded = liftM2 ((>>) . guard)
toMaybe = (. return) . (>>) . guard
Regards,
lambdabot
:)
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
On Thu, 8 Nov 2007, Stuart Cook wrote:
> On 11/8/07, Tim Newsham <[EMAIL PROTECTED]> wrote:
> > Data.Maybe has functions for processing Maybe's but nothing useful
> > for creating maybe. I think the following would be a very useful
> > addition, a guarded function:
> >
> > guarded :: (a ->
On Wed, 7 Nov 2007, Tim Newsham wrote:
> Data.Maybe has functions for processing Maybe's but nothing useful
> for creating maybe. I think the following would be a very useful
> addition, a guarded function:
>
> guarded :: (a -> Bool) -> (a -> b) -> a -> Maybe b
> guarded p f x | p x
On 11/8/07, Tim Newsham <[EMAIL PROTECTED]> wrote:
> Data.Maybe has functions for processing Maybe's but nothing useful
> for creating maybe. I think the following would be a very useful
> addition, a guarded function:
>
> guarded :: (a -> Bool) -> (a -> b) -> a -> Maybe b
> guarded p f
On 7 Nov 2007, at 12:40 PM, Tim Newsham wrote:
Data.Maybe has functions for processing Maybe's but nothing useful
for creating maybe. I think the following would be a very useful
addition, a guarded function:
guarded :: (a -> Bool) -> (a -> b) -> a -> Maybe b
guarded p f x | p x
Data.Maybe has functions for processing Maybe's but nothing useful
for creating maybe. I think the following would be a very useful
addition, a guarded function:
guarded :: (a -> Bool) -> (a -> b) -> a -> Maybe b
guarded p f x | p x = Just (f x)
| otherwise = Noth