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)

#view Source

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

View the focus of a Getter.

#iview Source

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

View the focus of a Getter and its index.

#viewOn Source

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

Synonym for view, flipped.

#to Source

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

Convert a function into a getter.

#takeBoth Source

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

Combine two getters.

#use Source

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

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

#iuse Source

iuse :: forall m b a t s i. 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.

Re-exports from Data.Lens.Types

#Optic Source

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

A general-purpose Data.Lens.

#IndexedGetter Source

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

An indexed getter.

#IndexedFold Source

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

An indexed fold.

#Indexed Source

newtype Indexed p i s t

Profunctor used for IndexedOptics.

Constructors

Instances

#Getter Source

type Getter s t a b = Fold a s t a b

A getter.

#Fold Source

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

A fold.