Commit ecf5f3e8 authored by Kai-Oliver Prott's avatar Kai-Oliver Prott
Browse files

Add liftM3 to Control.Monad

parent 8019368c
...@@ -2,7 +2,7 @@ module Control.Monad ...@@ -2,7 +2,7 @@ module Control.Monad
( Functor(..), Applicative(..), Monad(..) ( Functor(..), Applicative(..), Monad(..)
, filterM, (>=>), (<=<), forever, mapAndUnzipM, zipWithM , filterM, (>=>), (<=<), forever, mapAndUnzipM, zipWithM
, zipWithM_, foldM, foldM_, replicateM, replicateM_ , zipWithM_, foldM, foldM_, replicateM, replicateM_
, when, unless , when, unless, liftM3
) where ) where
import Control.Applicative import Control.Applicative
...@@ -81,3 +81,11 @@ replicateM_ cnt0 f = ...@@ -81,3 +81,11 @@ replicateM_ cnt0 f =
--- The reverse of 'when'. --- The reverse of 'when'.
unless :: (Applicative f) => Bool -> f () -> f () unless :: (Applicative f) => Bool -> f () -> f ()
unless p s = if p then pure () else s unless p s = if p then pure () else s
liftM3 :: Monad m => (a -> b -> c -> d) -> m a -> m b -> m c -> m d
liftM3 f ma mb mc = do
a <- ma
b <- mb
c <- mc
return (f a b c)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment