PTraversal

fun interface PTraversal<S, T, A, B> : PSetter<S, T, A, B> (source)

A Traversal is an optic that allows to see into a structure with 0 to N foci.

Traversal is a generalisation of kotlin.collections.map and can be seen as a representation of modify. all methods are written in terms of modify

Parameters

S

the source of a PTraversal

T

the modified source of a PTraversal

A

the target of a PTraversal

B

the modified target of a PTraversal

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
open infix fun <U, V> choice(other: PSetter<U, V, A, B>): PSetter<Either<S, U>, Either<T, V>, A, B>

Join two PSetter with the same target

open fun <U, V> choice(other: PTraversal<U, V, A, B>): PTraversal<Either<S, U>, Either<T, V>, A, B>
Link copied to clipboard
open infix fun <C, D> compose(other: PSetter<in A, out B, out C, in D>): PSetter<S, T, C, D>

Compose a PSetter with a PSetter

open infix fun <C, D> compose(other: PTraversal<in A, out B, out C, in D>): PTraversal<S, T, C, D>

Compose a PTraversal with a PTraversal

Link copied to clipboard
open fun lift(map: (focus: A) -> B): (source: S) -> T

Lift a function map: (A) -> B to the context of S: (S) -> T`

Link copied to clipboard
abstract override fun modify(source: S, map: (focus: A) -> B): T

Modify polymorphically the focus of a PSetter with a function map.

Link copied to clipboard
open operator fun <C, D> plus(other: PSetter<in A, out B, out C, in D>): PSetter<S, T, C, D>
open operator fun <C, D> plus(other: PTraversal<in A, out B, out C, in D>): PTraversal<S, T, C, D>
Link copied to clipboard
open fun set(source: S, focus: B): T

Set polymorphically the focus of a PSetter with a value b.

Properties

Link copied to clipboard
open val <U, V> PLens<U, V, S, T>.every: PTraversal<U, V, A, B>

DSL to compose Traversal with a Lens for a structure S to see all its foci A

open val <U, V> PIso<U, V, S, T>.every: PTraversal<U, V, A, B>

DSL to compose Traversal with a Iso for a structure S to see all its foci A

open val <U, V> PPrism<U, V, S, T>.every: PTraversal<U, V, A, B>

DSL to compose Traversal with a Prism for a structure S to see all its foci A

open val <U, V> POptional<U, V, S, T>.every: PTraversal<U, V, A, B>

DSL to compose Traversal with a Optional for a structure S to see all its foci A

open val <U, V> PSetter<U, V, S, T>.every: PSetter<U, V, A, B>

DSL to compose Traversal with a Setter for a structure S to see all its foci A

open val <U, V> PTraversal<U, V, S, T>.every: PTraversal<U, V, A, B>

DSL to compose Traversal with a Traversal for a structure S to see all its foci A

open val <U, V> PEvery<U, V, S, T>.every: PTraversal<U, V, A, B>

DSL to compose Traversal with a PEvery for a structure S to see all its foci A

Inheritors

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Extensions

Link copied to clipboard
fun <T, S, I, A> Traversal<T, S>.at(AT: At<S, I, A>, i: I): Traversal<T, A>

DSL to compose At with a Traversal for a structure S to focus in on A at given index I.

fun <T, S, I, A> Setter<T, S>.at(AT: At<S, I, A>, i: I): Setter<T, A>

DSL to compose At with a Setter for a structure S to focus in on A at given index I.

Link copied to clipboard
fun <T, S, A> Traversal<T, S>.every(TR: Every<S, A>): Traversal<T, A>

DSL to compose Traversal with a Traversal for a structure S to see all its foci A

fun <T, S, A> Setter<T, S>.every(TR: Every<S, A>): Setter<T, A>

DSL to compose Traversal with a Setter for a structure S to see all its foci A

Link copied to clipboard
fun <T, S, I, A> Traversal<T, S>.index(ID: Index<S, I, A>, i: I): Traversal<T, A>

DSL to compose Index with a Traversal for a structure S to focus in on A at given index I

fun <T, S, I, A> Setter<T, S>.index(ID: Index<S, I, A>, i: I): Setter<T, A>

DSL to compose Index with a Setter for a structure S to focus in on A at given index I

Link copied to clipboard
val <A, L, R> Traversal<A, Either<L, R>>.left: Traversal<A, L>

DSL to compose a Traversal with focus Either with a Prism with a focus of Either.Left<L>

Link copied to clipboard
val <A, L, R> Traversal<A, Either<L, R>>.right: Traversal<A, R>

DSL to compose a Traversal with focus Either with a Prism with a focus of Either.Right<R>

Link copied to clipboard

DSL to compose a Prism with focus arrow.core.Some with a Traversal with a focus of Option<S>

val <T, S> Setter<T, Option<S>>.some: Setter<T, S>

DSL to compose a Prism with focus arrow.core.Some with a Setter with a focus of Option<S>