diff options
author | 2012-01-03 00:29:27 -0400 | |
---|---|---|
committer | 2012-01-03 00:29:27 -0400 | |
commit | ee554542c1f3ee63efe5533267cf9cd1e5c83d52 (patch) | |
tree | c5378041794d4a7faad6316e915cffb804e153d2 /Utility | |
parent | 34abd7bca80a8cc012f92d64116014449b1b2392 (diff) |
after is a better name for observe_
Diffstat (limited to 'Utility')
-rw-r--r-- | Utility/Monad.hs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/Utility/Monad.hs b/Utility/Monad.hs index 7f9c7b1bc..be48072cb 100644 --- a/Utility/Monad.hs +++ b/Utility/Monad.hs @@ -29,14 +29,13 @@ anyM p = liftM isJust . firstM p 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. -} +{- Runs an 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 -{- Like observe, but the observer is not passed the value. -} -observe_ :: (Monad m) => m b -> m a -> m a -observe_ observer = observe (const observer) +{- b `after` a runs first a, then b, and returns the value of a -} +after :: (Monad m) => m b -> m a -> m a +after = observe . const |