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 b a t s. s -> AGetter s t a b -> a

Synonym for view, flipped.

#view Source

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

View the focus of a Getter.

#to Source

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

Convert a function into a getter.

#takeBoth Source

takeBoth :: forall d c b a t s. 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 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.

#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.

#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.

#cloneGetter Source

cloneGetter :: forall b a t s. 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

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 = forall r. Fold r s t a b

A getter.

#Fold Source

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

A fold.

#AGetter Source

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