Portability | Rank2Types |
---|---|
Stability | provisional |
Maintainer | Edward Kmett <ekmett@gmail.com> |
Safe Haskell | Safe-Inferred |
- type Loupe s t a b = LensLike (Context a b) s t a b
- storing :: Loupe s t a b -> b -> s -> t
- (^#) :: s -> Loupe s t a b -> a
- (#~) :: Loupe s t a b -> b -> s -> t
- (#%~) :: Loupe s t a b -> (a -> b) -> s -> t
- (#%%~) :: Functor f => Loupe s t a b -> (a -> f b) -> s -> f t
- (<#~) :: Loupe s t a b -> b -> s -> (b, t)
- (<#%~) :: Loupe s t a b -> (a -> b) -> s -> (b, t)
- (#=) :: MonadState s m => Loupe s s a b -> b -> m ()
- (#%=) :: MonadState s m => Loupe s s a b -> (a -> b) -> m ()
- (#%%=) :: MonadState s m => Loupe s s a b -> (a -> (r, b)) -> m r
- (<#=) :: MonadState s m => Loupe s s a b -> b -> m b
- (<#%=) :: MonadState s m => Loupe s s a b -> (a -> b) -> m b
- type SimpleLoupe s a = Loupe s s a a
Lenses
type Loupe s t a b = LensLike (Context a b) s t a bSource
A
is almost a Loupe
s t a bLens
. 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.
(<#~) :: 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 -> (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
type SimpleLoupe s a = Loupe s s a aSource
typeSimpleLoupe
=Simple
Loupe