arrow-optics / arrow.optics

Package arrow.optics

Types

Fold interface Fold<S, A> : FoldOf<S, A>
A Fold is an optic that allows to focus into structure and get multiple results.
ForFold class ForFold
ForGetter class ForGetter
ForPIso class ForPIso
ForPLens class ForPLens
ForPOptional class ForPOptional
ForPPrism class ForPPrism
ForPSetter class ForPSetter
ForPTraversal class ForPTraversal
Getter interface Getter<S, A> : GetterOf<S, A>
A Getter is an optic that allows to see into a structure and getting a focus.
PIso interface PIso<S, T, A, B> : PIsoOf<S, T, A, B>
An Iso is a loss less invertible optic that defines an isomorphism between a type S and A i.e. a data class and its properties represented by TupleN
PLens interface PLens<S, T, A, B> : PLensOf<S, T, A, B>
A Lens (or Functional Reference) is an optic that can focus into a structure for getting, setting or modifying the focus (target).
POptional interface POptional<S, T, A, B> : POptionalOf<S, T, A, B>
An Optional is an optic that allows to see into a structure and getting, setting or modifying an optional focus.
PPrism interface PPrism<S, T, A, B> : PPrismOf<S, T, A, B>
A Prism is a loss less invertible optic that can look into a structure and optionally find its focus. Mostly used for finding a focus that is only present under certain conditions i.e. list head Prism<List, Int>
PSetter interface PSetter<S, T, A, B> : PSetterOf<S, T, A, B>
A Setter is an optic that allows to see into a structure and set or modify its focus.
PTraversal interface PTraversal<S, T, A, B> : PTraversalOf<S, T, A, B>
A Traversal is an optic that allows to see into a structure with 0 to N foci.

Type Aliases

FoldKindedJ typealias FoldKindedJ<S, A> = HkJ2<ForFold, S, A>
FoldOf typealias FoldOf<S, A> = Kind2<ForFold, S, A>
FoldPartialOf typealias FoldPartialOf<S> = Kind<ForFold, S>
ForIso typealias ForIso = ForPIso
ForLens typealias ForLens = ForPLens
ForOptional typealias ForOptional = ForPOptional
ForPrism typealias ForPrism = ForPPrism
ForSetter typealias ForSetter = ForPSetter
ForTraversal typealias ForTraversal = ForPTraversal
GetterKindedJ typealias GetterKindedJ<S, A> = HkJ2<ForGetter, S, A>
GetterOf typealias GetterOf<S, A> = Kind2<ForGetter, S, A>
GetterPartialOf typealias GetterPartialOf<S> = Kind<ForGetter, S>
Iso typealias Iso<S, A> = PIso<S, S, A, A>
Iso is a type alias for PIso which fixes the type arguments and restricts the PIso to monomorphic updates.
IsoKindedJ typealias IsoKindedJ<S, A> = PIsoKindedJ<S, S, A, A>
IsoOf typealias IsoOf<S, A> = PIsoOf<S, S, A, A>
IsoPartialOf typealias IsoPartialOf<S> = Kind<ForIso, S>
Lens typealias Lens<S, A> = PLens<S, S, A, A>
Lens is a type alias for PLens which fixes the type arguments and restricts the PLens to monomorphic updates.
LensKindedJ typealias LensKindedJ<S, A> = PLensKindedJ<S, S, A, A>
LensOf typealias LensOf<S, A> = PLensOf<S, S, A, A>
LensPartialOf typealias LensPartialOf<S> = Kind<ForLens, S>
Optional typealias Optional<S, A> = POptional<S, S, A, A>
Optional is a type alias for POptional which fixes the type arguments and restricts the POptional to monomorphic updates.
OptionalKindedJ typealias OptionalKindedJ<S, A> = POptionalKindedJ<S, S, A, A>
OptionalOf typealias OptionalOf<S, A> = POptionalOf<S, S, A, A>
OptionalPartialOf typealias OptionalPartialOf<S> = Kind<ForOptional, S>
PIsoKindedJ typealias PIsoKindedJ<S, T, A, B> = HkJ4<ForPIso, S, T, A, B>
PIsoOf typealias PIsoOf<S, T, A, B> = Kind4<ForPIso, S, T, A, B>
PIsoPartialOf typealias PIsoPartialOf<S, T, A> = Kind3<ForPIso, S, T, A>
PLensKindedJ typealias PLensKindedJ<S, T, A, B> = HkJ4<ForPLens, S, T, A, B>
PLensOf typealias PLensOf<S, T, A, B> = Kind4<ForPLens, S, T, A, B>
PLensPartialOf typealias PLensPartialOf<S, T, A> = Kind3<ForPLens, S, T, A>
POptionalKindedJ typealias POptionalKindedJ<S, T, A, B> = HkJ4<ForPOptional, S, T, A, B>
POptionalOf typealias POptionalOf<S, T, A, B> = Kind4<ForPOptional, S, T, A, B>
POptionalPartialOf typealias POptionalPartialOf<S, T, A> = Kind3<ForPOptional, S, T, A>
PPrismKindedJ typealias PPrismKindedJ<S, T, A, B> = HkJ4<ForPPrism, S, T, A, B>
PPrismOf typealias PPrismOf<S, T, A, B> = Kind4<ForPPrism, S, T, A, B>
PPrismPartialOf typealias PPrismPartialOf<S, T, A> = Kind3<ForPPrism, S, T, A>
PSetterKindedJ typealias PSetterKindedJ<S, T, A, B> = HkJ4<ForPSetter, S, T, A, B>
PSetterOf typealias PSetterOf<S, T, A, B> = Kind4<ForPSetter, S, T, A, B>
PSetterPartialOf typealias PSetterPartialOf<S, T, A> = Kind3<ForPSetter, S, T, A>
PTraversalKindedJ typealias PTraversalKindedJ<S, T, A, B> = HkJ4<ForPTraversal, S, T, A, B>
PTraversalOf typealias PTraversalOf<S, T, A, B> = Kind4<ForPTraversal, S, T, A, B>
PTraversalPartialOf typealias PTraversalPartialOf<S, T, A> = Kind3<ForPTraversal, S, T, A>
Prism typealias Prism<S, A> = PPrism<S, S, A, A>
Prism is a type alias for PPrism which fixes the type arguments and restricts the PPrism to monomorphic updates.
PrismKindedJ typealias PrismKindedJ<S, A> = PPrismKindedJ<S, S, A, A>
PrismOf typealias PrismOf<S, A> = PPrismOf<S, S, A, A>
PrismPartialOf typealias PrismPartialOf<S> = Kind<ForPrism, S>
Setter typealias Setter<S, A> = PSetter<S, S, A, A>
Setter is a type alias for PSetter which fixes the type arguments and restricts the PSetter to monomorphic updates.
SetterKindedJ typealias SetterKindedJ<S, A> = PSetterKindedJ<S, S, A, A>
SetterOf typealias SetterOf<S, A> = PSetterOf<S, S, A, A>
SetterPartialOf typealias SetterPartialOf<S> = Kind<ForSetter, S>
Traversal typealias Traversal<S, A> = PTraversal<S, S, A, A>
Traversal is a type alias for PTraversal which fixes the type arguments and restricts the PTraversal to monomorphic updates.
TraversalKindedJ typealias TraversalKindedJ<S, A> = PTraversalKindedJ<S, S, A, A>
TraversalOf typealias TraversalOf<S, A> = PTraversalOf<S, S, A, A>
TraversalPartialOf typealias TraversalPartialOf<S> = Kind<ForTraversal, S>

Extensions for External Classes

arrow.Kind  
arrow.core.Either  
arrow.core.Id  
arrow.core.ListExtensions  
arrow.core.Option  
arrow.core.SetExtensions  
arrow.core.Try  
arrow.core.Tuple10  
arrow.core.Tuple2  
arrow.core.Tuple3  
arrow.core.Tuple4  
arrow.core.Tuple5  
arrow.core.Tuple6  
arrow.core.Tuple7  
arrow.core.Tuple8  
arrow.core.Tuple9  
arrow.data.ListK  
arrow.data.MapK  
arrow.data.NonEmptyList  
arrow.data.Validated  
kotlin.String  

Functions

all fun <S, T, A, B> PPrism<S, T, A, B>.all(s: S, p: (A) -> Boolean): Boolean
Check if there is no focus or the focus satisfies the predicate
assign fun <S, A> Lens<S, A>.assign(a: A): State<S, A>
Assign the focus A viewed through the Lens and returns its new value.fun <S, A> Optional<S, A>.assign(a: A): State<S, Option<A>>
Assign the focus A viewed through the Optional and returns its new value.fun <S, A> Traversal<S, A>.assign(a: A): State<S, ListK<A>>
Assign the focus A viewed through the Traversal and returns its new value.
assignOld fun <S, A> Lens<S, A>.assignOld(a: A): State<S, A>
Assign the value focus A through the Lens and returns its old value.fun <S, A> Optional<S, A>.assignOld(a: A): State<S, Option<A>>
Assign the value focus A through the Optional and returns its old value.fun <S, A> Traversal<S, A>.assignOld(a: A): State<S, ListK<A>>
Assign the focus A viewed through the Traversal and returns its old value.
assign_ fun <S, A> Lens<S, A>.assign_(a: A): State<S, Unit>
Assign the focus A viewed through the Lens and ignores both values.fun <S, A> Optional<S, A>.assign_(a: A): State<S, Unit>
Assign the focus A viewed through the Optional and ignores both values.fun <S, A> Setter<S, A>.assign_(a: A): State<S, Unit>
Set the focus A referenced through the Setter.fun <S, A> Traversal<S, A>.assign_(a: A): State<S, Unit>
Assign the focus A viewed through the Traversal and ignores both values.
exist fun <S, T, A, B> PPrism<S, T, A, B>.exist(s: S, p: (A) -> Boolean): Boolean
Check if there is a focus and it satisfies the predicate
find fun <S, T, A, B> PPrism<S, T, A, B>.find(s: S, p: (A) -> Boolean): Option<A>
Find the focus that satisfies the predicate
left fun <S, T, A, B, C> PPrism<S, T, A, B>.left(): PPrism<Either<S, C>, Either<T, C>, Either<A, C>, Either<B, C>>
Create a sum of the PPrism and a type C
lift fun <S, T, A, B> PPrism<S, T, A, B>.lift(f: (A) -> B): (S) -> T
Lift a function f: (A) -> B to the context of S: (S) -> T`
liftOption fun <S, T, A, B> PPrism<S, T, A, B>.liftOption(f: (A) -> B): (S) -> Option<T>
Lift a function f: (A) -> B to the context of S: (S) -> Option`
modify fun <S, T, A, B> PPrism<S, T, A, B>.modify(s: S, f: (A) -> B): T
Modify the focus of a PPrism with a function
modifyOption fun <S, T, A, B> PPrism<S, T, A, B>.modifyOption(s: S, f: (A) -> B): Option<T>
Modify the focus of a PPrism with a function
right fun <S, T, A, B, C> PPrism<S, T, A, B>.right(): PPrism<Either<C, S>, Either<C, T>, Either<C, A>, Either<C, B>>
Create a sum of a type C and the PPrism
update fun <S, A> Lens<S, A>.update(f: (A) -> A): State<S, A>
Update the focus A viewed through the Lens and returns its new value.fun <S, A> Optional<S, A>.update(f: (A) -> A): State<S, Option<A>>
Update the focus A viewed through the Optional and returns its new value.fun <S, A> Traversal<S, A>.update(f: (A) -> A): State<S, ListK<A>>
Update the focus A viewed through the Traversal and returns its new value.
updateOld fun <S, A> Lens<S, A>.updateOld(f: (A) -> A): State<S, A>
Update the focus A viewed through the Lens and returns its old value.fun <S, A> Optional<S, A>.updateOld(f: (A) -> A): State<S, Option<A>>
Update the focus A viewed through the Optional and returns its old value.fun <S, A> Traversal<S, A>.updateOld(f: (A) -> A): State<S, ListK<A>>
Update the focus A viewed through the Traversal and returns its old value.
update_ fun <S, A> Lens<S, A>.update_(f: (A) -> A): State<S, Unit>
Modify the focus A viewed through the Lens and ignores both values.fun <S, A> Optional<S, A>.update_(f: (A) -> A): State<S, Unit>
Update the focus A viewed through the Optional and ignores both values.fun <S, A> Setter<S, A>.update_(f: (A) -> A): State<S, Unit>
Update the focus A referenced through the Setter.fun <S, A> Traversal<S, A>.update_(f: (A) -> A): State<S, Unit>
Update the focus A viewed through the Traversal and ignores both values

Companion Object Functions

invoke operator fun <S, A> PPrism.Companion.invoke(getOption: (S) -> Option<A>, reverseGet: (A) -> S): Prism<S, A>
Invoke operator overload to create a PPrism of type S with a focus A where A is a subtype of S Can also be used to construct Prism