X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=Control%2FMonad.hs;h=0650e7a893843b2cf672ea67af503e4d06af4e62;hb=685432ac839f249ccd98bdf79fcf0c985872380b;hp=407bfc42f5b25a5108cdf4485a7f1d2ca47009a9;hpb=b52d0975be192c19eb353728d4fc8f1d02e542ff;p=ghc-base.git diff --git a/Control/Monad.hs b/Control/Monad.hs index 407bfc4..0650e7a 100644 --- a/Control/Monad.hs +++ b/Control/Monad.hs @@ -28,7 +28,7 @@ module Control.Monad -- ** Naming conventions -- $naming - -- ** Basic functions from the "Prelude" + -- ** Basic @Monad@ functions , mapM -- :: (Monad m) => (a -> m b) -> [a] -> m [b] , mapM_ -- :: (Monad m) => (a -> m b) -> [a] -> m () @@ -40,6 +40,7 @@ module Control.Monad , (>=>) -- :: (Monad m) => (a -> m b) -> (b -> m c) -> (a -> m c) , (<=<) -- :: (Monad m) => (b -> m c) -> (a -> m b) -> (a -> m c) , forever -- :: (Monad m) => m a -> m b + , void -- ** Generalisations of list functions @@ -182,7 +183,7 @@ infixr 1 <=<, >=> (>=>) :: Monad m => (a -> m b) -> (b -> m c) -> (a -> m c) f >=> g = \x -> f x >>= g --- | Right-to-left Kleisli composition of monads. '(>=>)', with the arguments flipped +-- | Right-to-left Kleisli composition of monads. @('>=>')@, with the arguments flipped (<=<) :: Monad m => (b -> m c) -> (a -> m b) -> (a -> m c) (<=<) = flip (>=>) @@ -219,11 +220,11 @@ zipWithM_ f xs ys = sequence_ (zipWith f xs ys) {- | The 'foldM' function is analogous to 'foldl', except that its result is encapsulated in a monad. Note that 'foldM' works from left-to-right over -the list arguments. This could be an issue where '(>>)' and the `folded +the list arguments. This could be an issue where @('>>')@ and the `folded function' are not commutative. -> foldM f a1 [x1, x2, ..., xm ] +> foldM f a1 [x1, x2, ..., xm] ==