Module

Data.Lens

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

This module re-exports types and functions from other modules:

  • module Data.Lens.Iso
  • module Data.Lens.Lens
  • module Data.Lens.Prism
  • module Data.Lens.Traversal
  • module Data.Lens.Types
  • module Data.Lens.Setter
  • module Data.Lens.Getter
  • module Data.Lens.Fold
  • module Data.Lens.Common

Re-exports from Data.Lens.Common

#united Source

united :: forall a. Lens' a Unit

There is a Unit in everything.

#second

second :: forall p c b a. Strong p => p b c -> p (Tuple a b) (Tuple a c)

#right

right :: forall p c b a. Choice p => p b c -> p (Either a b) (Either a c)

#left

left :: forall p c b a. Choice p => p a b -> p (Either a c) (Either b c)

#first

first :: forall p c b a. Strong p => p a b -> p (Tuple a c) (Tuple b c)

#_Right Source

_Right :: forall c b a. Prism (Either c a) (Either c b) a b

Prism for the Right constructor of Either.

#_Nothing Source

_Nothing :: forall b a. Prism (Maybe a) (Maybe b) Unit Unit

Prism for the Nothing constructor of Maybe.

#_Left Source

_Left :: forall c b a. Prism (Either a c) (Either b c) a b

Prism for the Left constructor of Either.

#_Just Source

_Just :: forall b a. Prism (Maybe a) (Maybe b) a b

Prism for the Just constructor of Maybe.

#_2 Source

_2 :: forall c b a. Lens (Tuple c a) (Tuple c b) a b

Lens for the second component of a Tuple.

#_1 Source

_1 :: forall c b a. Lens (Tuple a c) (Tuple b c) a b

Lens for the first component of a Tuple.

Re-exports from Data.Lens.Fold

#unfolded Source

unfolded :: forall b a t s r. Monoid r => (s -> Maybe (Tuple a s)) -> Fold r s t a b

Builds a Fold using an unfold.

#toListOfOn Source

toListOfOn :: forall b a t s. s -> Fold (Endo (List a)) s t a b -> List a

Synonym for toListOf, reversed.

#toListOf Source

toListOf :: forall b a t s. Fold (Endo (List a)) s t a b -> s -> List a

Collects the foci of a Fold into a list.

#sumOf Source

sumOf :: forall b a t s. Semiring a => Fold (Additive a) s t a b -> s -> a

The sum of all foci of a Fold.

#sequenceOf_ Source

sequenceOf_ :: forall b a t s f. Applicative f => Fold (Endo (f Unit)) s t (f a) b -> s -> f Unit

Sequence the foci of a Fold, pulling out an Applicative, and ignore the result. If you need the result, see sequenceOf for Traversals.

#replicated Source

replicated :: forall r t b a. Monoid r => Int -> Fold r a b a t

Replicates the elements of a fold.

#productOf Source

productOf :: forall b a t s. Semiring a => Fold (Multiplicative a) s t a b -> s -> a

The product of all foci of a Fold.

#previewOn Source

previewOn :: forall b a t s. s -> Fold (First a) s t a b -> Maybe a

Synonym for preview, flipped.

#preview Source

preview :: forall b a t s. Fold (First a) s t a b -> s -> Maybe a

Previews the first value of a fold, if there is any.

#orOf Source

orOf :: forall b a t s. HeytingAlgebra a => Fold (Disj a) s t a b -> s -> a

The disjunction of all foci of a Fold.

#notElemOf Source

notElemOf :: forall b a t s. Eq a => Fold (Conj Boolean) s t a b -> a -> s -> Boolean

Whether a Fold not contains a given element.

#minimumOf Source

minimumOf :: forall b a t s. Ord a => Fold (Endo (Maybe a)) s t a b -> s -> Maybe a

The minimum of all foci of a Fold, if there is any.

#maximumOf Source

maximumOf :: forall b a t s. Ord a => Fold (Endo (Maybe a)) s t a b -> s -> Maybe a

The maximum of all foci of a Fold, if there is any.

#lengthOf Source

lengthOf :: forall b a t s. Fold (Additive Int) s t a b -> s -> Int

The number of foci of a Fold.

#lastOf Source

lastOf :: forall b a t s. Fold (Last a) s t a b -> s -> Maybe a

The last focus of a Fold, if there is any.

#itraverseOf_ Source

itraverseOf_ :: forall r b a t s f i. Applicative f => IndexedFold (Endo (f Unit)) i s t a b -> (i -> a -> f r) -> s -> f Unit

Traverse the foci of an IndexedFold, discarding the results.

#itoListOf Source

itoListOf :: forall b a t s i. IndexedFold (Endo (List (Tuple i a))) i s t a b -> s -> List (Tuple i a)

Collects the foci of an IndexedFold into a list.

#ifoldrOf Source

ifoldrOf :: forall r b a t s i. IndexedFold (Endo r) i s t a b -> (i -> a -> r -> r) -> r -> s -> r

Right fold over an IndexedFold.

#ifoldlOf Source

ifoldlOf :: forall r b a t s i. IndexedFold (Dual (Endo r)) i s t a b -> (i -> r -> a -> r) -> r -> s -> r

Left fold over an IndexedFold.

#ifoldMapOf Source

ifoldMapOf :: forall b a t s i r. IndexedFold r i s t a b -> (i -> a -> r) -> s -> r

Fold map over an IndexedFold.

#ianyOf Source

ianyOf :: forall r b a t s i. HeytingAlgebra r => IndexedFold (Disj r) i s t a b -> (i -> a -> r) -> s -> r

Whether any focus of an IndexedFold satisfies a predicate.

#iallOf Source

iallOf :: forall r b a t s i. HeytingAlgebra r => IndexedFold (Conj r) i s t a b -> (i -> a -> r) -> s -> r

Whether all foci of an IndexedFold satisfy a predicate.

#hasn't Source

hasn't :: forall r b a t s. HeytingAlgebra r => Fold (Conj r) s t a b -> s -> r

Determines whether a Fold does not have a focus.

#has Source

has :: forall r b a t s. HeytingAlgebra r => Fold (Disj r) s t a b -> s -> r

Determines whether a Fold has at least one focus.

#foldrOf Source

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

Right fold over a Fold.

#foldlOf Source

foldlOf :: forall r b a t s. Fold (Dual (Endo r)) s t a b -> (r -> a -> r) -> r -> s -> r

Left fold over a Fold.

#folded Source

folded :: forall r t b a g. Monoid r => Foldable g => Fold r (g a) b a t

Folds over a Foldable container.

#foldOf Source

foldOf :: forall b a t s. Fold a s t a b -> s -> a

Folds all foci of a Fold to one. Note that this is the same as view.

#foldMapOf Source

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

Maps and then folds all foci of a Fold.

#firstOf Source

firstOf :: forall b a t s. Fold (First a) s t a b -> s -> Maybe a

The first focus of a Fold, if there is any. Synonym for preview.

#findOf Source

findOf :: forall b a t s. Fold (Endo (Maybe a)) s t a b -> (a -> Boolean) -> s -> Maybe a

Find the first focus of a Fold that satisfies a predicate, if there is any.

#filtered Source

filtered :: forall a p. Choice p => (a -> Boolean) -> Optic' p a a

Filters on a predicate.

#elemOf Source

elemOf :: forall b a t s. Eq a => Fold (Disj Boolean) s t a b -> a -> s -> Boolean

Whether a Fold contains a given element.

#anyOf Source

anyOf :: forall r b a t s. HeytingAlgebra r => Fold (Disj r) s t a b -> (a -> r) -> s -> r

Whether any focus of a Fold satisfies a predicate.

#andOf Source

andOf :: forall b a t s. HeytingAlgebra a => Fold (Conj a) s t a b -> s -> a

The conjunction of all foci of a Fold.

#allOf Source

allOf :: forall r b a t s. HeytingAlgebra r => Fold (Conj r) s t a b -> (a -> r) -> s -> r

Whether all foci of a Fold satisfy a predicate.

#(^?) Source

Operator alias for Data.Lens.Fold.previewOn (left-associative / precedence 8)

#(^..) Source

Operator alias for Data.Lens.Fold.toListOfOn (left-associative / precedence 8)

Re-exports from Data.Lens.Getter

#viewOn Source

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

Synonym for view, flipped.

#view Source

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

View the focus of a Getter.

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

#to Source

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

Convert a function into 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.

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

#(^.) Source

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

Re-exports from Data.Lens.Iso

#withIso Source

withIso :: forall r b a t s. AnIso s t a b -> ((s -> a) -> (b -> t) -> r) -> r

Extracts the pair of morphisms from an isomorphism.

#under Source

under :: forall b a t s. AnIso s t a b -> (t -> s) -> b -> a

#uncurried Source

uncurried :: forall f e d c b a. Iso (a -> b -> c) (d -> e -> f) (Tuple a b -> c) (Tuple d e -> f)

#re Source

re :: forall b a t s p. Optic (Re p a b) s t a b -> Optic p b a t s

Reverses an optic.

#non Source

non :: forall a. Eq a => a -> Iso' (Maybe a) a

If a1 is obtained from a by removing a single value, then Maybe a1 is isomorphic to a.

#iso Source

iso :: forall b a t s. (s -> a) -> (b -> t) -> Iso s t a b

Create an Iso from a pair of morphisms.

#flipped Source

flipped :: forall f e d c b a. Iso (a -> b -> c) (d -> e -> f) (b -> a -> c) (e -> d -> f)

#curried Source

curried :: forall f e d c b a. Iso (Tuple a b -> c) (Tuple d e -> f) (a -> b -> c) (d -> e -> f)

#cloneIso Source

cloneIso :: forall b a t s. AnIso s t a b -> Iso s t a b

Extracts an Iso from AnIso.

#auf Source

auf :: forall p r e b a t s. Profunctor p => AnIso s t a b -> (p r a -> e -> b) -> p r s -> e -> t

#au Source

au :: forall e b a t s. AnIso s t a b -> ((b -> t) -> e -> s) -> e -> a

Re-exports from Data.Lens.Lens

#withLens Source

withLens :: forall r b a t s. ALens s t a b -> ((s -> a) -> (s -> b -> t) -> r) -> r

#lens' Source

lens' :: forall b a t s. (s -> Tuple a (b -> t)) -> Lens s t a b

#lens Source

lens :: forall b a t s. (s -> a) -> (s -> b -> t) -> Lens s t a b

Create a Lens from a getter/setter pair.

#cloneLens Source

cloneLens :: forall b a t s. ALens s t a b -> Lens s t a b

Re-exports from Data.Lens.Prism

#withPrism Source

withPrism :: forall r b a t s. APrism s t a b -> ((b -> t) -> (s -> Either t a) -> r) -> r

#review Source

review :: forall b a t s. Review s t a b -> b -> t

Review a value through a Prism.

#prism' Source

prism' :: forall a s. (a -> s) -> (s -> Maybe a) -> Prism' s a

#prism Source

prism :: forall b a t s. (b -> t) -> (s -> Either t a) -> Prism s t a b

Create a Prism from a constructor/pattern pair.

#only Source

only :: forall a. Eq a => a -> Prism a a Unit Unit

#nearly Source

nearly :: forall a. a -> (a -> Boolean) -> Prism' a Unit

#matching Source

matching :: forall b a t s. APrism s t a b -> s -> Either t a

#isn't Source

isn't :: forall r b a t s. HeytingAlgebra r => APrism s t a b -> s -> r

#is Source

is :: forall r b a t s. HeytingAlgebra r => APrism s t a b -> s -> r

#clonePrism Source

clonePrism :: forall b a t s. APrism s t a b -> Prism s t a b

Re-exports from Data.Lens.Setter

#subOver Source

subOver :: forall a t s. Ring a => Setter s t a a -> a -> s -> t

#subModifying Source

subModifying :: forall m a s. MonadState s m => Ring a => Setter' s a -> a -> m Unit

#setJust Source

setJust :: forall b a t s. Setter s t a (Maybe b) -> b -> s -> t

#set Source

set :: forall b a t s. Setter s t a b -> b -> s -> t

Set the foci of a Setter to a constant value.

#over Source

over :: forall b a t s. Setter s t a b -> (a -> b) -> s -> t

Apply a function to the foci of a Setter.

#mulOver Source

mulOver :: forall a t s. Semiring a => Setter s t a a -> a -> s -> t

#mulModifying Source

mulModifying :: forall m a s. MonadState s m => Semiring a => Setter' s a -> a -> m Unit

#modifying Source

modifying :: forall m b a s. MonadState s m => Setter s s a b -> (a -> b) -> m Unit

Modify the foci of a Setter in a monadic state.

#iover Source

iover :: forall b a t s i. IndexedSetter i s t a b -> (i -> a -> b) -> s -> t

Apply a function to the foci of a Setter that may vary with the index.

#divOver Source

divOver :: forall a t s. EuclideanRing a => Setter s t a a -> a -> s -> t

#divModifying Source

divModifying :: forall m a s. MonadState s m => EuclideanRing a => Setter' s a -> a -> m Unit

#disjOver Source

disjOver :: forall a t s. HeytingAlgebra a => Setter s t a a -> a -> s -> t

#disjModifying Source

disjModifying :: forall m a s. MonadState s m => HeytingAlgebra a => Setter' s a -> a -> m Unit

#conjOver Source

conjOver :: forall a t s. HeytingAlgebra a => Setter s t a a -> a -> s -> t

#conjModifying Source

conjModifying :: forall m a s. MonadState s m => HeytingAlgebra a => Setter' s a -> a -> m Unit

#assignJust Source

assignJust :: forall m b a s. MonadState s m => Setter s s a (Maybe b) -> b -> m Unit

#assign Source

assign :: forall m b a s. MonadState s m => Setter s s a b -> b -> m Unit

Set the foci of a Setter in a monadic state to a constant value.

#appendOver Source

appendOver :: forall a t s. Semigroup a => Setter s t a a -> a -> s -> t

#appendModifying Source

appendModifying :: forall m a s. MonadState s m => Semigroup a => Setter' s a -> a -> m Unit

#addOver Source

addOver :: forall a t s. Semiring a => Setter s t a a -> a -> s -> t

#addModifying Source

addModifying :: forall m a s. MonadState s m => Semiring a => Setter' s a -> a -> m Unit

#(||~) Source

Operator alias for Data.Lens.Setter.disjOver (right-associative / precedence 4)

#(||=) Source

Operator alias for Data.Lens.Setter.disjModifying (non-associative / precedence 4)

#(?~) Source

Operator alias for Data.Lens.Setter.setJust (right-associative / precedence 4)

#(?=) Source

Operator alias for Data.Lens.Setter.assignJust (non-associative / precedence 4)

#(<>~) Source

Operator alias for Data.Lens.Setter.appendOver (right-associative / precedence 4)

#(<>=) Source

Operator alias for Data.Lens.Setter.appendModifying (non-associative / precedence 4)

#(//~) Source

Operator alias for Data.Lens.Setter.divOver (right-associative / precedence 4)

#(//=) Source

Operator alias for Data.Lens.Setter.divModifying (non-associative / precedence 4)

#(.~) Source

Operator alias for Data.Lens.Setter.set (right-associative / precedence 4)

#(.=) Source

Operator alias for Data.Lens.Setter.assign (non-associative / precedence 4)

#(-~) Source

Operator alias for Data.Lens.Setter.subOver (right-associative / precedence 4)

#(-=) Source

Operator alias for Data.Lens.Setter.subModifying (non-associative / precedence 4)

#(+~) Source

Operator alias for Data.Lens.Setter.addOver (right-associative / precedence 4)

#(+=) Source

Operator alias for Data.Lens.Setter.addModifying (non-associative / precedence 4)

#(++~) Source

Operator alias for Data.Lens.Setter.appendOver (right-associative / precedence 4)

#(++=) Source

Operator alias for Data.Lens.Setter.appendModifying (non-associative / precedence 4)

#(*~) Source

Operator alias for Data.Lens.Setter.mulOver (right-associative / precedence 4)

#(*=) Source

Operator alias for Data.Lens.Setter.mulModifying (non-associative / precedence 4)

#(&&~) Source

Operator alias for Data.Lens.Setter.conjOver (right-associative / precedence 4)

#(&&=) Source

Operator alias for Data.Lens.Setter.conjModifying (non-associative / precedence 4)

#(%~) Source

Operator alias for Data.Lens.Setter.over (right-associative / precedence 4)

#(%=) Source

Operator alias for Data.Lens.Setter.modifying (non-associative / precedence 4)

Re-exports from Data.Lens.Traversal

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

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

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

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

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

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.

#Tagged Source

newtype Tagged a b

Constructors

Instances

#Shop Source

data Shop a b s t

The Shop profunctor characterizes a Lens.

Constructors

  • Shop (s -> a) (s -> b -> t)

Instances

#Setter' Source

type Setter' s a = Setter s s a a

#Setter Source

type Setter s t a b = Optic Function s t a b

A setter.

#Review' Source

type Review' s a = Review s s a a

#Review Source

type Review s t a b = Optic Tagged s t a b

A review.

#Re Source

newtype Re p s t a b

Constructors

  • Re (p b a -> p t s)

Instances

#Prism' Source

type Prism' s a = Prism s s a a

#Prism Source

type Prism s t a b = forall p. Choice p => Optic p s t a b

A prism.

#Optic' Source

type Optic' p s a = Optic p s s a a

#Optic Source

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

A general-purpose Data.Lens.

#Market Source

data Market a b s t

The Market profunctor characterizes a Prism.

Constructors

Instances

#Lens' Source

type Lens' s a = Lens s s a a

#Lens Source

type Lens s t a b = forall p. Strong p => Optic p s t a b

A lens.

#Iso' Source

type Iso' s a = Iso s s a a

#Iso Source

type Iso s t a b = forall p. Profunctor p => Optic p s t a b

A generalized isomorphism.

#IndexedTraversal' Source

type IndexedTraversal' i s a = IndexedTraversal i s s a a

#IndexedTraversal Source

type IndexedTraversal i s t a b = forall p. Wander p => IndexedOptic p i s t a b

An indexed traversal.

#IndexedSetter' Source

type IndexedSetter' i s a = IndexedSetter i s s a a

#IndexedSetter Source

type IndexedSetter i s t a b = IndexedOptic Function i s t a b

An indexed setter.

#IndexedOptic' Source

type IndexedOptic' p i s a = IndexedOptic p i s s a a

#IndexedOptic Source

type IndexedOptic p i s t a b = Indexed p i a b -> p s t

An indexed optic.

#IndexedGetter' Source

type IndexedGetter' i s a = IndexedGetter i s s a a

#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 a = IndexedFold r i s s a a

#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 a = Getter s s a a

#Getter Source

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

A getter.

#Forget Source

newtype Forget r a b

Profunctor that forgets the b value and returns (and accumulates) a value of type r.

Forget r is isomorphic to Star (Const r), but can be given a Cochoice instance.

Constructors

Instances

#Fold' Source

type Fold' r s a = Fold r s s a a

#Fold Source

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

A fold.

#Exchange Source

data Exchange a b s t

The Exchange profunctor characterizes an Iso.

Constructors

Instances

#AnIso' Source

type AnIso' s a = AnIso s s a a

#AnIso Source

type AnIso s t a b = Optic (Exchange a b) s t a b

#APrism' Source

type APrism' s a = APrism s s a a

#APrism Source

type APrism s t a b = Optic (Market a b) s t a b

#ALens' Source

type ALens' s a = ALens s s a a

#ALens Source

type ALens s t a b = Optic (Shop a b) s t a b

#Wander Source

class (Strong p, Choice p) <= Wander p  where

Class for profunctors that support polymorphic traversals.

Members

  • wander :: forall b a t s. (forall f. Applicative f => (a -> f b) -> s -> f t) -> p a b -> p s t

Instances