add a new useful thing
This commit is contained in:
parent
97d5789157
commit
442202dd6d
1 changed files with 8 additions and 0 deletions
|
@ -28,3 +28,11 @@ anyM p = liftM isJust . firstM p
|
|||
{- Runs an action on values from a list until it succeeds. -}
|
||||
untilTrue :: (Monad m) => [a] -> (a -> m Bool) -> m Bool
|
||||
untilTrue = flip anyM
|
||||
|
||||
{- Runs a monadic action, passing its value to an observer
|
||||
- before returning it. -}
|
||||
observe :: (Monad m) => (a -> m b) -> m a -> m a
|
||||
observe observer a = do
|
||||
r <- a
|
||||
_ <- observer r
|
||||
return r
|
||||
|
|
Loading…
Reference in a new issue