X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Futils%2FMonadUtils.hs;h=9b364aebb7901d8cd289e5cec7c400edb825f7bc;hb=8ee215b9aa2fe37b435e404aad8bb07c6ce1836d;hp=733eda17005dbac5ba482493241ca368735915d1;hpb=5e5a08eb37f5513cecb47101a97fdaf09c4be040;p=ghc-hetmet.git diff --git a/compiler/utils/MonadUtils.hs b/compiler/utils/MonadUtils.hs index 733eda1..9b364ae 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