Module

Data.Lens.Traversal

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

This module defines functions for working with traversals.

#traversed Source

traversed :: forall b a t. Traversable t => Traversal (t a) (t b) a b

Create a Traversal which traverses the elements of a Traversable functor.

#traverseOf Source

traverseOf :: forall b a t s f. Applicative f => Optic (Star f) s t a b -> (a -> f b) -> s -> f t

Turn a pure profunctor Traversal into a lens-like Traversal.

#sequenceOf Source

sequenceOf :: forall a t s f. Applicative f => Optic (Star f) s t (f a) a -> s -> f t

Sequence the foci of a Traversal, pulling out an Applicative effect. If you do not need the result, see sequenceOf_ for Folds.

#failover Source

failover :: forall b a t s f. Alternative f => Optic (Star (Tuple (Disj Boolean))) s t a b -> (a -> b) -> s -> f t

Tries to map over a Traversal; returns empty if the traversal did not have any new focus.

#element Source

element :: forall a t s p. Wander p => Int -> Traversal s t a a -> Optic p s t a a

Affine traversal the n-th focus of a Traversal.

#elementsOf Source

elementsOf :: forall a t s i p. Wander p => IndexedTraversal i s t a a -> (i -> Boolean) -> IndexedOptic p i s t a a

Traverse elements of an IndexedTraversal whose index satisfy a predicate.

#itraverseOf Source

itraverseOf :: forall b a t s i f. Applicative f => IndexedOptic (Star f) i s t a b -> (i -> a -> f b) -> s -> f t

Turn a pure profunctor IndexedTraversal into a lens-like IndexedTraversal.

Re-exports from Data.Lens.Types

#Traversal' Source

type Traversal' s a = Traversal s s a a

#Traversal Source

type Traversal s t a b = forall p. Wander p => Optic p s t a b

A traversal.