lens-3.7.4: Lenses, Folds and Traversals

Portabilityrank 2 types, MPTCs
Stabilityexperimental
MaintainerEdward Kmett <ekmett@gmail.com>
Safe HaskellSafe-Inferred

Control.Lens.IndexedGetter

Contents

Description

 

Synopsis

Indexed Getters

type IndexedGetter i s a = forall k f. (Indexable i k, Gettable f) => k (a -> f a) (s -> f s)Source

Every IndexedGetter is a valid IndexedFold and Getter.

type IndexedGetting i m s t a b = Indexed i (a -> Accessor m b) (s -> Accessor m t)Source

Used to consume an IndexedFold.

newtype ReifiedIndexedGetter i s a Source

Useful for storage.

Indexed Getter Combinators

iview :: MonadReader s m => IndexedGetting i (i, a) s t a b -> m (i, a)Source

View the index and value of an IndexedGetter into the current environment as a pair.

When applied to an IndexedFold the result will most likely be a nonsensical monoidal summary of the indices tupled with a monoidal summary of the values and probably not whatever it is you wanted.

iviews :: MonadReader s m => IndexedGetting i r s t a b -> (i -> a -> r) -> m rSource

View a function of the index and value of an IndexedGetter into the current environment

When applied to an IndexedFold the result will be a monoidal summary instead of a single answer.

iviewsifoldMapOf

iuse :: MonadState s m => IndexedGetting i (i, a) s t a b -> m (i, a)Source

Use the index and value of an IndexedGetter into the current state as a pair.

When applied to an IndexedFold the result will most likely be a nonsensical monoidal summary of the indices tupled with a monoidal summary of the values and probably not whatever it is you wanted.

iuses :: MonadState s m => IndexedGetting i r s t a b -> (i -> a -> r) -> m rSource

Use a function of the index and value of an IndexedGetter into the current state.

When applied to an IndexedFold the result will be a monoidal summary instead of a single answer.