X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=Control%2FMonad.hs;h=07b4d3b487680a71857477ecde627a7907156145;hb=65c23237b8e85a2caef9956b267bbe18ac7679df;hp=734aae449cf5bba329ca7e797afecc6c1c7e8ca9;hpb=550bd82e4fa20eb3ac0613d5a8e145bf69e4d9cd;p=ghc-base.git diff --git a/Control/Monad.hs b/Control/Monad.hs index 734aae4..07b4d3b 100644 --- a/Control/Monad.hs +++ b/Control/Monad.hs @@ -1,4 +1,4 @@ -{-# OPTIONS -fno-implicit-prelude #-} +{-# OPTIONS_GHC -fno-implicit-prelude #-} ----------------------------------------------------------------------------- -- | -- Module : Control.Monad @@ -173,7 +173,9 @@ function' are not commutative. > foldM f a1 [x1, x2, ..., xm ] + == + > do > a2 <- f a1 x1 > a3 <- f a2 x2 @@ -252,20 +254,20 @@ ap = liftM2 id The functions in this library use the following naming conventions: -* A postfix `M' always stands for a function in the Kleisli category: +* A postfix \`M\' always stands for a function in the Kleisli category: @m@ is added to function results (modulo currying) and nowhere else. So, for example, > filter :: (a -> Bool) -> [a] -> [a] > filterM :: (Monad m) => (a -> m Bool) -> [a] -> m [a] -* A postfix `_' changes the result type from @(m a)@ to @(m ())@. +* A postfix \`_\' changes the result type from @(m a)@ to @(m ())@. Thus (in the "Prelude"): > sequence :: Monad m => [m a] -> m [a] > sequence_ :: Monad m => [m a] -> m () -* A prefix `m' generalises an existing function to a monadic form. +* A prefix \`m\' generalises an existing function to a monadic form. Thus, for example: > sum :: Num a => [a] -> a