summaryrefslogtreecommitdiff
path: root/Utility/Monad.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-12-03 09:10:23 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-12-03 09:10:23 -0400
commit64672c6262048e9498be667f8dc7460c0a9189e2 (patch)
tree194453dc8731dff8207bbc76bc752ad472c1f795 /Utility/Monad.hs
parentb5930f6d076d266b337b415447f448fbb14d9ea3 (diff)
refactor
Diffstat (limited to 'Utility/Monad.hs')
-rw-r--r--Utility/Monad.hs4
1 files changed, 4 insertions, 0 deletions
diff --git a/Utility/Monad.hs b/Utility/Monad.hs
index 9523e1716..0d1675fa4 100644
--- a/Utility/Monad.hs
+++ b/Utility/Monad.hs
@@ -24,3 +24,7 @@ firstM p (x:xs) = do
- stopping once one is found. -}
anyM :: (Monad m) => (a -> m Bool) -> [a] -> m Bool
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