| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Serokell.Util.Lens
Description
Extra operators on Lens
- (%%=) :: Lens' s a -> State a b -> State s b
- (%?=) :: Lens' s a -> ExceptT t (State a) b -> ExceptT t (State s) b
- class Monad m => WrappedM m where
- type UnwrappedM m :: * -> *
- _UnwrappedM :: WrappedM m => Iso' (UnwrappedM m a) (m a)
- 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
class Monad m => WrappedM m where Source #
Similar to Wrapped, but for Monads.
Associated Types
type UnwrappedM m :: * -> * Source #
Methods
_WrappedM :: Iso' (m a) (UnwrappedM m a) Source #
packM :: m a -> UnwrappedM m a Source #
unpackM :: UnwrappedM m a -> m a Source #
Instances
| Monad m => WrappedM (LoggerNameBox m) Source # | |
_UnwrappedM :: WrappedM m => Iso' (UnwrappedM m a) (m a) Source #
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.
magnify' :: MonadReader s m => LensLike' (Magnified (Reader s) a) s t -> ReaderT t Identity a -> m a Source #
A magnify which works in arbitrary MonadReader.