optics-core-0.4.1.1: Optics as an abstract interface: core definitions

Safe Haskell | None
Language | Haskell2010

Optics.Operators

Description

Defines some infix operators for optics operations. This is a deliberately small collection.

If you like operators, you may also wish to import `Optics.State.Operators` from the `optics-extra` package.

Synopsis

- (^.) :: forall k s (is :: IxList) a. Is k A_Getter => s -> Optic' k is s a -> a
- (^..) :: forall k s (is :: IxList) a. Is k A_Fold => s -> Optic' k is s a -> [a]
- (^?) :: forall k s (is :: IxList) a. Is k An_AffineFold => s -> Optic' k is s a -> Maybe a
- (#) :: forall k (is :: IxList) t b. Is k A_Review => Optic' k is t b -> b -> t
- (%~) :: forall k (is :: IxList) s t a b. Is k A_Setter => Optic k is s t a b -> (a -> b) -> s -> t
- (%!~) :: forall k (is :: IxList) s t a b. Is k A_Setter => Optic k is s t a b -> (a -> b) -> s -> t
- (.~) :: forall k (is :: IxList) s t a b. Is k A_Setter => Optic k is s t a b -> b -> s -> t
- (!~) :: forall k (is :: IxList) s t a b. Is k A_Setter => Optic k is s t a b -> b -> s -> t
- (?~) :: forall k (is :: IxList) s t a b. Is k A_Setter => Optic k is s t a (Maybe b) -> b -> s -> t
- (?!~) :: forall k (is :: IxList) s t a b. Is k A_Setter => Optic k is s t a (Maybe b) -> b -> s -> t

# Documentation

(^.) :: forall k s (is :: IxList) a. Is k A_Getter => s -> Optic' k is s a -> a infixl 8 Source #

Flipped infix version of `view`.

(^..) :: forall k s (is :: IxList) a. Is k A_Fold => s -> Optic' k is s a -> [a] infixl 8 Source #

Flipped infix version of `toListOf`.

(^?) :: forall k s (is :: IxList) a. Is k An_AffineFold => s -> Optic' k is s a -> Maybe a infixl 8 Source #

Flipped infix version of `preview`.

(#) :: forall k (is :: IxList) t b. Is k A_Review => Optic' k is t b -> b -> t infixr 8 Source #

Infix version of `review`.

(%~) :: forall k (is :: IxList) s t a b. Is k A_Setter => Optic k is s t a b -> (a -> b) -> s -> t infixr 4 Source #

Infix version of `over`.

(%!~) :: forall k (is :: IxList) s t a b. Is k A_Setter => Optic k is s t a b -> (a -> b) -> s -> t infixr 4 Source #

Infix version of `over'`.

(.~) :: forall k (is :: IxList) s t a b. Is k A_Setter => Optic k is s t a b -> b -> s -> t infixr 4 Source #

Infix version of `set`.

(!~) :: forall k (is :: IxList) s t a b. Is k A_Setter => Optic k is s t a b -> b -> s -> t infixr 4 Source #

Infix version of `set'`.

(?~) :: forall k (is :: IxList) s t a b. Is k A_Setter => Optic k is s t a (Maybe b) -> b -> s -> t infixr 4 Source #

Set the target of a `Setter` to `Just` a value.

    o ?~ b ≡ set o (Just b)

    >>> Nothing & equality ?~ 'x'
    Just 'x'

    >>> Map.empty & at 3 ?~ 'x'
    fromList [(3,'x')]

(?!~) :: forall k (is :: IxList) s t a b. Is k A_Setter => Optic k is s t a (Maybe b) -> b -> s -> t infixr 4 Source #

Strict version of (`?~`).