Portability | non-portable (TF,GNTD) |
---|---|

Stability | experimental |

Maintainer | hans@hanshoglund.se |

Safe Haskell | Safe-Inferred |

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
- asum :: (Foldable t, Alternative f) => t (f a) -> f a
- afold :: (Alternative f, Foldable t) => t a -> f a
- afromList :: Alternative f => [a] -> f a
- afromMaybe :: Alternative f => Maybe a -> f a

# Basics

module Control.Applicative

asum :: (Foldable t, Alternative f) => t (f a) -> f a

The sum of a collection of actions, generalizing `concat`

.

# Constructing

afold :: (Alternative f, Foldable t) => t a -> f aSource

Fold a value into an arbitrary `MonadPlus`

type.

This function generalizes the `toList`

function.

afromList :: Alternative f => [a] -> f aSource

This function generalizes the `listToMaybe`

function.

afromMaybe :: Alternative f => Maybe a -> f aSource

Translate maybe to an arbitrary `Alternative`

type.

This function generalizes the `maybeToList`

function.