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

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

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

Stability | provisional |

Portability | Rank2Types |

Safe Haskell | Safe-Inferred |

Language | Haskell98 |

This module exports a minimalist API for working with lenses in highly monomorphic settings.

- type ALens s t a b = LensLike (Pretext (->) a b) s t a b
- type ALens' s a = ALens s s a a
- cloneLens :: ALens s t a b -> Lens s t a b
- storing :: ALens s t a b -> b -> s -> t
- (^#) :: s -> ALens s t a b -> a
- (#~) :: ALens s t a b -> b -> s -> t
- (#%~) :: ALens s t a b -> (a -> b) -> s -> t
- (#%%~) :: Functor f => ALens s t a b -> (a -> f b) -> s -> f t
- (<#~) :: ALens s t a b -> b -> s -> (b, t)
- (<#%~) :: ALens s t a b -> (a -> b) -> s -> (b, t)
- (#=) :: MonadState s m => ALens s s a b -> b -> m ()
- (#%=) :: MonadState s m => ALens s s a b -> (a -> b) -> m ()
- (#%%=) :: MonadState s m => ALens s s a b -> (a -> (r, b)) -> m r
- (<#=) :: MonadState s m => ALens s s a b -> b -> m b
- (<#%=) :: MonadState s m => ALens s s a b -> (a -> b) -> m b
- type Loupe s t a b = LensLike (Pretext (->) a b) s t a b
- type SimpleLoupe s a = Loupe s s a a

# Documentation

cloneLens :: ALens s t a b -> Lens s t a b Source

Cloning a `Lens`

is one way to make sure you aren't given
something weaker, such as a `Traversal`

and can be
used as a way to pass around lenses that have to be monomorphic in `f`

.

Note: This only accepts a proper `Lens`

.

`>>>`

("hello",2,"you")`let example l x = set (cloneLens l) (x^.cloneLens l + 1) x in example _2 ("hello",1,"you")`

(^#) :: s -> ALens s t a b -> a infixl 8 Source

A version of ('Control.Lens.Getter.^.') that works on `ALens`

.

`>>>`

"world"`("hello","world")^#_2`

(#=) :: MonadState s m => ALens s s a b -> b -> m () infix 4 Source

(#%=) :: MonadState s m => ALens s s a b -> (a -> b) -> m () infix 4 Source

(#%%=) :: MonadState s m => ALens s s a b -> (a -> (r, b)) -> m r infix 4 Source

(<#=) :: MonadState s m => ALens s s a b -> b -> m b infix 4 Source

(<#%=) :: MonadState s m => ALens s s a b -> (a -> b) -> m b infix 4 Source

# Deprecated Aliases

type Loupe s t a b = LensLike (Pretext (->) a b) s t a b Source

Deprecated: use ALens

This is an older alias for a type-restricted form of lens that is able to be passed around in containers monomorphically.

Deprecated. This has since been renamed to `ALens`

for consistency.

type SimpleLoupe s a = Loupe s s a a Source