Module

Data.Lens.Getter

Package
purescript-profunctor-lenses
Repository
purescript-contrib/purescript-profunctor-lenses

This module defines functions for working with getters.

#(^.) Source

Operator alias for Data.Lens.Getter.viewOn (left-associative / precedence 8)

#viewOn Source

viewOn :: forall s t a b. s -> AGetter s t a b -> a

Synonym for view, flipped.

#view Source

view :: forall s t a b. AGetter s t a b -> s -> a

View the focus of a Getter.

#to Source

to :: forall s t a b. (s -> a) -> Getter s t a b

Convert a function into a getter.

#takeBoth Source

takeBoth :: forall s t a b c d. AGetter s t a b -> AGetter s t c d -> Getter s t (Tuple a c) (Tuple b d)

Combine two getters.

#use Source

use :: forall s t a b m. MonadState s m => Getter s t a b -> m a

View the focus of a Getter in the state of a monad.

#iview Source

iview :: forall i s t a b. IndexedFold (Tuple i a) i s t a b -> s -> Tuple i a

View the focus of a Getter and its index.

#iuse Source

iuse :: forall i s t a b m. MonadState s m => IndexedFold (Tuple i a) i s t a b -> m (Tuple i a)

View the focus of a Getter and its index in the state of a monad.

#cloneGetter Source

cloneGetter :: forall s t a b. AGetter s t a b -> Getter s t a b

Re-exports from Data.Lens.Types

#Optic Source

type Optic p s t a b = p a b -> p s t

#IndexedGetter Source

type IndexedGetter i s t a b = IndexedFold a i s t a b

#IndexedFold Source

type IndexedFold r i s t a b = IndexedOptic (Forget r) i s t a b

#Indexed Source

newtype Indexed p i s t

Constructors

Instances

#Getter Source

type Getter s t a b = forall r. Fold r s t a b

#Fold Source

type Fold r s t a b = Optic (Forget r) s t a b

#AGetter Source

type AGetter s t a b = Fold a s t a b