From 3a1efe1aff0c21f1d6d4150a3b05c32d79be2398 Mon Sep 17 00:00:00 2001 From: Richard Lupton Date: Sun, 11 Aug 2019 20:05:58 +0100 Subject: Re-export foldlM and foldrM from Data.Foldable in MonadUtils (#16969) --- compiler/utils/MonadUtils.hs | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'compiler') diff --git a/compiler/utils/MonadUtils.hs b/compiler/utils/MonadUtils.hs index 936ae62751..72669b9362 100644 --- a/compiler/utils/MonadUtils.hs +++ b/compiler/utils/MonadUtils.hs @@ -32,7 +32,7 @@ import Control.Applicative import Control.Monad import Control.Monad.Fix import Control.Monad.IO.Class -import Data.Foldable (sequenceA_, foldr) +import Data.Foldable (sequenceA_, foldlM, foldrM) import Data.List (unzip4, unzip5, zipWith4) ------------------------------------------------------------------------------- @@ -190,18 +190,10 @@ allM f (b:bs) = (f b) >>= (\bv -> if bv then allM f bs else return False) orM :: Monad m => m Bool -> m Bool -> m Bool orM m1 m2 = m1 >>= \x -> if x then return True else m2 --- | Monadic version of foldl -foldlM :: (Monad m, Foldable t) => (a -> b -> m a) -> a -> t b -> m a -foldlM = foldM - -- | Monadic version of foldl that discards its result foldlM_ :: (Monad m, Foldable t) => (a -> b -> m a) -> a -> t b -> m () foldlM_ = foldM_ --- | Monadic version of foldr -foldrM :: (Monad m, Foldable t) => (b -> a -> m a) -> a -> t b -> m a -foldrM k z x = foldr (\x r -> r >>= k x) (pure z) x - -- | Monadic version of fmap specialised for Maybe maybeMapM :: Monad m => (a -> m b) -> (Maybe a -> m (Maybe b)) maybeMapM _ Nothing = return Nothing -- cgit v1.2.1