| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Serokell.Util.Lens
Description
Extra operators on Lens
Synopsis
- (%%=) :: Lens' s a -> State a b -> State s b
- (%?=) :: Lens' s a -> ExceptT t (State a) b -> ExceptT t (State s) b
- zoom' :: MonadState s m => LensLike' (Zoomed (State s) a) s t -> StateT t Identity a -> m a
- magnify' :: MonadReader s m => LensLike' (Magnified (Reader s) a) s t -> ReaderT t Identity a -> m a
Documentation
(%%=) :: Lens' s a -> State a b -> State s b infix 4 Source #
Similar to %= operator, but takes State action instead of (a -> a)
(%?=) :: Lens' s a -> ExceptT t (State a) b -> ExceptT t (State s) b infix 4 Source #
Like %%= but with possiblity of failure
zoom' :: MonadState s m => LensLike' (Zoomed (State s) a) s t -> StateT t Identity a -> m a Source #
A zoom which works in arbitrary MonadState.
See https://github.com/ekmett/lens/issues/580. You might be surprised
but actual zoom doesn't work in any MonadState, it only works in a
handful of state monads and their combinations defined by Zoom.