-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Haskell98 partial maps and filters over MonadPlus. -- -- Filtering and folding over arbitrary MonadPlus instances. This -- package generalizes many common stream operations such as -- filter, catMaybes etc. @package monadplus @version 1.3 -- | Partial maps and filters over MonadPlus instances. -- -- This is especially useful for sequential structures such as event -- lists, tracks etc. -- -- Inspired by the Conal Elliott's blog post: -- -- module Control.Monad.Plus -- | This generalizes the list-based concat function. msum :: MonadPlus m => [m a] -> m a -- | This generalizes the list-based concat function. msum' :: (MonadPlus m, Foldable t) => t (m a) -> m a -- | Fold a value into an arbitrary MonadPlus type. -- -- This function generalizes the toList function. mfold :: (MonadPlus m, Foldable t) => t a -> m a -- | Translate a list to an arbitrary MonadPlus type. -- -- This function generalizes the listToMaybe function. mfromList :: MonadPlus m => [a] -> m a -- | Translate maybe to an arbitrary MonadPlus type. -- -- This function generalizes the maybeToList function. mfromMaybe :: MonadPlus m => Maybe a -> m a -- | mfilter', applied to a predicate and a container, returns the -- container of those elements that satisfy the predicate; i.e., -- --
--   filter p xs = [ x | x <- xs, p x]
--   
-- -- This function generalizes the filter function. (Identical to -- mfilter, it is just here for documentation purposes). mfilter' :: MonadPlus m => (a -> Bool) -> m a -> m a -- | The partition function takes a predicate a list and returns the -- pair of lists of elements which do and do not satisfy the predicate, -- respectively; i.e., -- --
--   partition p xs == (filter p xs, filter (not . p) xs)
--   
-- -- This function generalizes the partition function. mpartition :: MonadPlus m => (a -> Bool) -> m a -> (m a, m a) -- | Pass through Just occurrences. -- -- This function generalizes the catMaybes function. mscatter :: MonadPlus m => m [b] -> m b -- | Pass through Just occurrences. -- -- This function generalizes the catMaybes function. mscatter' :: (MonadPlus m, Foldable t) => m (t b) -> m b -- | Pass through Just occurrences. -- -- This function generalizes the catMaybes function. mcatMaybes :: MonadPlus m => m (Maybe a) -> m a -- | Pass through Left occurrences. -- -- This function generalizes the lefts function. mlefts :: MonadPlus m => m (Either a b) -> m a -- | Pass through Right occurrences. -- -- This function generalizes the rights function. mrights :: MonadPlus m => m (Either a b) -> m b -- | Separate Left and Right occurances. -- -- This function generalizes the partitionEithers function. mpartitionEithers :: MonadPlus m => m (Either a b) -> (m a, m b) -- | Modify or discard a value. -- -- This function generalizes the mapMaybe function. mmapMaybe :: MonadPlus m => (a -> Maybe b) -> m a -> m b -- | Modify and return a number of values. -- -- This function generalizes the concatMap function. mconcatMap :: MonadPlus m => (a -> [b]) -> m a -> m b -- | Partial maps and filters over Alternative instances. -- -- This is considerably weaker than MonadPlus, as we have no -- possibility of removing intermediate structure, as in -- mcatMaybes. module Control.Applicative.Alternative -- | The sum of a collection of actions, generalizing concat. asum :: (Foldable t, Alternative f) => t (f a) -> f a -- | This generalizes the list-based concat function. asum' :: (Alternative f, Foldable t) => t (f a) -> f a -- | Fold a value into an arbitrary MonadPlus type. -- -- This function generalizes the toList function. afold :: (Alternative f, Foldable t) => t a -> f a -- | This function generalizes the listToMaybe function. afromList :: Alternative f => [a] -> f a -- | Translate maybe to an arbitrary Alternative type. -- -- This function generalizes the maybeToList function. afromMaybe :: Alternative f => Maybe a -> f a