Control.Applicative.Alternative

monadplus-1.4.2: Haskell98 partial maps and filters over MonadPlus.

Copyright | (c) Hans Hoglund 2012
License | BSD-style
Maintainer | hans@hanshoglund.se
Stability | experimental
Portability | non-portable (TF,GNTD)
Safe Haskell | Safe
Language | Haskell98

Control.Applicative.Alternative

Contents

- Basics
- Constructing

Description

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`.

Synopsis

- 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 a #

Fold a value into an arbitrary `MonadPlus` type.

This function generalizes the `toList` function.

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

This function generalizes the `listToMaybe` function.

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

Translate maybe to an arbitrary `Alternative` type.

This function generalizes the `maybeToList` function.