diff options
author | Nathan Collins <conathan@galois.com> | 2017-12-05 00:09:23 -0800 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2018-01-02 16:28:09 -0500 |
commit | 69f1e49dfe33de4e077ec8b1e43432929a4e833e (patch) | |
tree | 15428c5ef390ffe3adac4e46a01bd6f9c1a8d971 /libraries/base | |
parent | 12f5c00543e1f3dc7109e3575fcc4a973aebdacc (diff) | |
download | haskell-69f1e49dfe33de4e077ec8b1e43432929a4e833e.tar.gz |
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.
Diffstat (limited to 'libraries/base')
-rw-r--r-- | libraries/base/Control/Monad.hs | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/libraries/base/Control/Monad.hs b/libraries/base/Control/Monad.hs index 3570144bd6..8d664e6210 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 |