Direct
MonadPlus equivalent of
filter.
Examples
The
filter function is just
mfilter specialized to the
list monad:
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