lens-3.6.0.4: Lenses, Folds and Traversals

PortabilityRank2Types
Stabilityprovisional
MaintainerEdward Kmett <ekmett@gmail.com>
Safe HaskellSafe-Inferred

Control.Lens.Loupe

Contents

Description

A Loupe is a minimalist Lens suitable for storing in containers or returning monadically that can still be composed with other lenses.

Synopsis

Lenses

type Loupe s t a b = LensLike (Context a b) s t a bSource

A Loupe s t a b is almost a Lens. It can be composed on the left of other lenses, you can use cloneLens to promote it to a Lens, and it provides a minimalist lens-like interface. They can be used in an API where you need to pass around lenses inside containers or as monadic results. Unlike a ReifiedLens they can be composed and used directly, but they are slightly lower performance.

storing :: Loupe s t a b -> b -> s -> tSource

A Loupe-specific version of set

(^#) :: s -> Loupe s t a b -> aSource

A Loupe-specific version of (^.)

(#~) :: Loupe s t a b -> b -> s -> tSource

A Loupe-specific version of (.~)

(#%~) :: Loupe s t a b -> (a -> b) -> s -> tSource

A Loupe-specific version of (%~)

(#%%~) :: Functor f => Loupe s t a b -> (a -> f b) -> s -> f tSource

A Loupe-specific version of (%%~)

(<#~) :: Loupe s t a b -> b -> s -> (b, t)Source

Replace the target of a Loupe and return the new value.

(<#%~) :: Loupe s t a b -> (a -> b) -> s -> (b, t)Source

Modify the target of a Loupe and return the result.

(#=) :: MonadState s m => Loupe s s a b -> b -> m ()Source

A Loupe-specific version of (.=)

(#%=) :: MonadState s m => Loupe s s a b -> (a -> b) -> m ()Source

A Loupe-specific version of (%=)

(#%%=) :: MonadState s m => Loupe s s a b -> (a -> (r, b)) -> m rSource

Modify the target of a Loupe in the current monadic state, returning an auxillary result.

(<#=) :: MonadState s m => Loupe s s a b -> b -> m bSource

Replace the target of a Loupe in the current monadic state, returning the new value.

(<#%=) :: MonadState s m => Loupe s s a b -> (a -> b) -> m bSource

Modify the target of a Loupe into your monad's state by a user supplied function and return the result.

Simplified