[commit: ghc] master: Reformat Control.Monad.mfilter docs (69f1e49)

git at git.haskell.org git at git.haskell.org
Tue Jan 2 23:56:23 UTC 2018


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/69f1e49dfe33de4e077ec8b1e43432929a4e833e/ghc

>---------------------------------------------------------------

commit 69f1e49dfe33de4e077ec8b1e43432929a4e833e
Author: Nathan Collins <conathan at galois.com>
Date:   Tue Dec 5 00:09:23 2017 -0800

    Reformat Control.Monad.mfilter docs
    
    The formatting was bad, with everything running together, and a
    paranthesis was missing. Now the examples and relation between
    `filter` and `mfilter` are typeset as code blocks instead of inline.


>---------------------------------------------------------------

69f1e49dfe33de4e077ec8b1e43432929a4e833e
 libraries/base/Control/Monad.hs | 25 +++++++++++++++++++------
 1 file changed, 19 insertions(+), 6 deletions(-)

diff --git a/libraries/base/Control/Monad.hs b/libraries/base/Control/Monad.hs
index 3570144..8d664e6 100644
--- a/libraries/base/Control/Monad.hs
+++ b/libraries/base/Control/Monad.hs
@@ -283,12 +283,25 @@ f <$!> m = do
 -- -----------------------------------------------------------------------------
 -- Other MonadPlus functions
 
--- | Direct 'MonadPlus' equivalent of 'filter'
--- @'filter'@ = @(mfilter:: (a -> Bool) -> [a] -> [a]@
--- applicable to any 'MonadPlus', for example
--- @mfilter odd (Just 1) == Just 1@
--- @mfilter odd (Just 2) == Nothing@
-
+-- | Direct 'MonadPlus' equivalent of 'Data.List.filter'.
+--
+-- ==== __Examples__
+--
+-- The 'Data.List.filter' function is just 'mfilter' specialized to
+-- the list monad:
+--
+-- @
+-- 'Data.List.filter' = ( 'mfilter' :: (a -> Bool) -> [a] -> [a] )
+-- @
+--
+-- An example using 'mfilter' with the 'Maybe' monad:
+--
+-- @
+-- >>> mfilter odd (Just 1)
+-- Just 1
+-- >>> mfilter odd (Just 2)
+-- Nothing
+-- @
 mfilter :: (MonadPlus m) => (a -> Bool) -> m a -> m a
 {-# INLINABLE mfilter #-}
 mfilter p ma = do



More information about the ghc-commits mailing list