Copyright | (C) 2013-2016 Edward Kmett 2015-2016 Artyom Kazak 2018 Monadfix |
---|---|

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

Safe Haskell | Safe |

Language | Haskell2010 |

This module provides types and functions that require `Contravariant`

; they aren't included in the main microlens package because contravariant has a lot of dependencies.

## Synopsis

- type Getter s a = forall f. (Contravariant f, Functor f) => (a -> f a) -> s -> f s
- fromSimpleGetter :: SimpleGetter s a -> Getter s a
- type Fold s a = forall f. (Contravariant f, Applicative f) => (a -> f a) -> s -> f s
- fromSimpleFold :: SimpleFold s a -> Fold s a

# Getter

type Getter s a = forall f. (Contravariant f, Functor f) => (a -> f a) -> s -> f s Source #

This is the same thing as `SimpleGetter`

but more generalised (so that it would fully match the type used in lens).

fromSimpleGetter :: SimpleGetter s a -> Getter s a Source #

Turn a `SimpleGetter`

into a true `Getter`

.

# Fold

type Fold s a = forall f. (Contravariant f, Applicative f) => (a -> f a) -> s -> f s Source #

This is the same thing as `SimpleFold`

but more generalised (so that it would fully match the type used in lens). See documentation of `SimpleFold`

for the list of functions that work on `Fold`

but don't work on `SimpleFold`

.

fromSimpleFold :: SimpleFold s a -> Fold s a Source #

Turn a `SimpleFold`

into a true `Fold`

.