Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Review
type Review t b = forall (p :: * -> * -> *) (f :: * -> *). (Choice p, Bifunctor p, Settable f) => Optic' p f t b #
review :: MonadReader b m => AReview t b -> m t #
This can be used to turn an Iso
or Prism
around and view
a value (or the current environment) through it the other way.
review
≡view
.
re
review
.unto
≡id
>>>
review _Left "mustard"
Left "mustard"
>>>
review (unto succ) 5
6
Usually review
is used in the (->)
Monad
with a Prism
or Iso
, in which case it may be useful to think of
it as having one of these more restricted type signatures:
review
::Iso'
s a -> a -> sreview
::Prism'
s a -> a -> s
However, when working with a Monad
transformer stack, it is sometimes useful to be able to review
the current environment, in which case
it may be beneficial to think of it as having one of these slightly more liberal type signatures:
review
::MonadReader
a m =>Iso'
s a -> m sreview
::MonadReader
a m =>Prism'
s a -> m s