Created
March 22, 2011 21:26
-
-
Save pbrisbin/882113 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- | Conditionally apply the monadic f to the Maybe value when it is | |
| -- Just and wrap the /inner/ value in Just, or return Nothing | |
| (=<?) :: (Monad m) => (a -> m b) -> Maybe a -> m (Maybe b) | |
| f =<? (Just a) = return . Just =<< f a | |
| f =<? Nothing = return Nothing | |
| -- can this not be done with some variation of liftM and fmap? |
Author
Ah yes. Thanks for that link.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Have a peek on Monad transformers. I think that's just what you're doing.