aboutsummaryrefslogtreecommitdiffstats
path: root/src/Control/Monad
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2019-01-27 19:59:11 +0100
committertv <tv@krebsco.de>2019-01-27 20:18:05 +0100
commit24d095cad7969a7bdadd1fa05c4742f4d66033e6 (patch)
treeba880690dc6dc39cfe2b512450ff8743ea3caf40 /src/Control/Monad
parentf91b27cf8dce8a92c0b296209323a79cc1e36873 (diff)
Reaktor.Plugins.System.hWithLines: use untilM_
Diffstat (limited to 'src/Control/Monad')
-rw-r--r--src/Control/Monad/Extended.hs14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/Control/Monad/Extended.hs b/src/Control/Monad/Extended.hs
new file mode 100644
index 0000000..d91b12c
--- /dev/null
+++ b/src/Control/Monad/Extended.hs
@@ -0,0 +1,14 @@
+module Control.Monad.Extended
+ ( module Control.Monad
+ , unlessM_
+ , untilM_
+ ) where
+
+import Control.Monad
+
+
+unlessM_ :: Monad m => m Bool -> m () -> m ()
+unlessM_ p f = p >>= flip unless f
+
+untilM_ :: Monad m => m Bool -> m a -> m ()
+untilM_ p f = unlessM_ p (f >> untilM_ p f)