Copyright | (C) 2012-14 Edward Kmett |
---|---|

License | BSD-style (see the file LICENSE) |

Maintainer | Edward Kmett <ekmett@gmail.com> |

Stability | experimental |

Portability | non-portable |

Safe Haskell | Safe |

Language | Haskell98 |

- type Action m s a = forall f r. Effective m r f => (a -> f a) -> s -> f s
- type MonadicFold m s a = forall f r. (Effective m r f, Applicative f) => (a -> f a) -> s -> f s
- type RelevantMonadicFold m s a = forall f r. (Effective m r f, Apply f) => (a -> f a) -> s -> f s
- type IndexedAction i m s a = forall p f r. (Indexable i p, Effective m r f) => p a (f a) -> s -> f s
- type IndexedMonadicFold i m s a = forall p f r. (Indexable i p, Effective m r f, Applicative f) => p a (f a) -> s -> f s
- type IndexedRelevantMonadicFold i m s a = forall p f r. (Indexable i p, Effective m r f, Apply f) => p a (f a) -> s -> f s
- type IndexPreservingAction m s a = forall p f r. (Conjoined p, Effective m r f) => p a (f a) -> p s (f s)
- type IndexPreservingMonadicFold m s a = forall p f r. (Conjoined p, Effective m r f, Applicative f) => p a (f a) -> p s (f s)
- type IndexPreservingRelevantMonadicFold m s a = forall p f r. (Conjoined p, Effective m r f, Apply f) => p a (f a) -> p s (f s)

# Getters and Folds

type MonadicFold m s a = forall f r. (Effective m r f, Applicative f) => (a -> f a) -> s -> f s Source #

A `MonadicFold`

is a `Fold`

enriched with access to a `Monad`

for side-effects.

A `MonadicFold`

can use side-effects to produce parts of the structure being folded (e.g. reading them from file).

Every `Fold`

can be used as a `MonadicFold`

, that simply ignores the access to the `Monad`

.

You can compose a `MonadicFold`

with another `MonadicFold`

using (`.`

) from the `Prelude`

.

type RelevantMonadicFold m s a = forall f r. (Effective m r f, Apply f) => (a -> f a) -> s -> f s Source #

# Indexed

type IndexedAction i m s a = forall p f r. (Indexable i p, Effective m r f) => p a (f a) -> s -> f s Source #

An `IndexedAction`

is an `IndexedGetter`

enriched with access to a `Monad`

for side-effects.

Every `Getter`

can be used as an `Action`

.

You can compose an `Action`

with another `Action`

using (`.`

) from the `Prelude`

.

type IndexedMonadicFold i m s a = forall p f r. (Indexable i p, Effective m r f, Applicative f) => p a (f a) -> s -> f s Source #

An `IndexedMonadicFold`

is an `IndexedFold`

enriched with access to a `Monad`

for side-effects.

Every `IndexedFold`

can be used as an `IndexedMonadicFold`

, that simply ignores the access to the `Monad`

.

You can compose an `IndexedMonadicFold`

with another `IndexedMonadicFold`

using (`.`

) from the `Prelude`

.

type IndexedRelevantMonadicFold i m s a = forall p f r. (Indexable i p, Effective m r f, Apply f) => p a (f a) -> s -> f s Source #

# Index-Preserving

type IndexPreservingAction m s a = forall p f r. (Conjoined p, Effective m r f) => p a (f a) -> p s (f s) Source #

An `IndexPreservingAction`

can be used as a `Action`

, but when composed with an `IndexedTraversal`

,
`IndexedFold`

, or `IndexedLens`

yields an `IndexedMonadicFold`

, `IndexedMonadicFold`

or `IndexedAction`

respectively.

type IndexPreservingMonadicFold m s a = forall p f r. (Conjoined p, Effective m r f, Applicative f) => p a (f a) -> p s (f s) Source #

An `IndexPreservingFold`

can be used as a `Fold`

, but when composed with an `IndexedTraversal`

,
`IndexedFold`

, or `IndexedLens`

yields an `IndexedFold`

respectively.