Safe Haskell | None |
---|---|

Language | Haskell2010 |

## Synopsis

- type View s a = forall p. (Strong p, CoerceR p) => Optic' p s a
- type Review t b = forall p. (Closed p, CoerceL p) => Optic' p t b
- to :: (s -> a) -> View s a
- from :: (b -> t) -> Review t b
- cloneView :: AView a s a -> View s a
- cloneReview :: AReview t b -> Review t b
- like :: a -> View s a
- relike :: t -> Review t b
- toProduct :: AView a1 s a1 -> AView a2 s a2 -> View s (a1, a2)
- fromSum :: AReview t b1 -> AReview t b2 -> Review t (b1 + b2)
- (^.) :: s -> AView a s a -> a
- view :: MonadReader s m => AView a s a -> m a
- views :: MonadReader s m => AView r s a -> (a -> r) -> m r
- use :: MonadState s m => AView a s a -> m a
- uses :: MonadState s m => Optic' (Star (Const r)) s a -> (a -> r) -> m r
- review :: MonadReader b m => AReview t b -> m t
- reviews :: MonadReader b m => AReview t b -> (t -> r) -> m r
- reuse :: MonadState b m => AReview t b -> m t
- reuses :: MonadState b m => AReview t b -> (t -> r) -> m r

# Types

# Constructors

cloneReview :: AReview t b -> Review t b Source #

TODO: Document

# Optics

# Operators

(^.) :: s -> AView a s a -> a infixl 8 Source #

View the focus of an optic.

Fixity and semantics are such that subsequent field accesses can be
performed with (`.`

).

`>>>`

"world"`("hello","world") ^. second'`

`>>>`

6`5 ^. to succ`

`>>>`

`import Data.Complex`

`>>>`

2.23606797749979`((0, 1 :+ 2), 3) ^. first' . second' . to magnitude`

view :: MonadReader s m => AView a s a -> m a Source #

views :: MonadReader s m => AView r s a -> (a -> r) -> m r Source #

use :: MonadState s m => AView a s a -> m a Source #

TODO: Document

review :: MonadReader b m => AReview t b -> m t Source #

reviews :: MonadReader b m => AReview t b -> (t -> r) -> m r Source #

reuse :: MonadState b m => AReview t b -> m t Source #