diff options
Diffstat (limited to 'compiler/utils/MonadUtils.hs')
-rw-r--r-- | compiler/utils/MonadUtils.hs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/compiler/utils/MonadUtils.hs b/compiler/utils/MonadUtils.hs index 733eda1700..9b364aebb7 100644 --- a/compiler/utils/MonadUtils.hs +++ b/compiler/utils/MonadUtils.hs @@ -18,7 +18,7 @@ module MonadUtils , concatMapM , mapMaybeM , anyM, allM - , foldlM, foldrM + , foldlM, foldlM_, foldrM , maybeMapM ) where @@ -146,6 +146,10 @@ allM f (b:bs) = (f b) >>= (\bv -> if bv then allM f bs else return False) foldlM :: (Monad m) => (a -> b -> m a) -> a -> [b] -> m a foldlM = foldM +-- | Monadic version of foldl that discards its result +foldlM_ :: (Monad m) => (a -> b -> m a) -> a -> [b] -> m () +foldlM_ = foldM_ + -- | Monadic version of foldr foldrM :: (Monad m) => (b -> a -> m a) -> a -> [b] -> m a foldrM _ z [] = return z |