arrow-optics / arrow.optics.extensions / MapTraversal

MapTraversal

interface MapTraversal<K, V> : Traversal<Map<K, V>, V>

Traversal for Map that focuses in each V of the source Map.

Functions

modifyF open fun <F> modifyF(FA: Applicative<F>, s: Map<K, V>, f: (V) -> Kind<F, V>): Kind<F, Map<K, V>>

Inherited Functions

asFold open fun asFold(): Fold<S, A>
asSetter open fun asSetter(): PSetter<S, T, A, B>
choice open fun <U, V> choice(other: PTraversal<U, V, A, B>): PTraversal<Either<S, U>, Either<T, V>, A, B>
combineAll open fun combineAll(M: Monoid<A>, s: S): A
Alias for fold.
compose open infix fun <C, D> compose(other: PTraversal<A, B, C, D>): PTraversal<S, T, C, D>
Compose a PTraversal with a PTraversalopen infix fun <C, D> compose(other: PSetter<A, B, C, D>): PSetter<S, T, C, D>
Compose a PTraversal with a PSetteropen infix fun <C, D> compose(other: POptional<A, B, C, D>): PTraversal<S, T, C, D>
Compose a PTraversal with a POptionalopen infix fun <C, D> compose(other: PLens<A, B, C, D>): PTraversal<S, T, C, D>
Compose a PTraversal with a PLensopen infix fun <C, D> compose(other: PPrism<A, B, C, D>): PTraversal<S, T, C, D>
Compose a PTraversal with a PPrismopen infix fun <C, D> compose(other: PIso<A, B, C, D>): PTraversal<S, T, C, D>
Compose a PTraversal with a PIsoopen infix fun <C> compose(other: Fold<A, C>): Fold<S, C>
Compose a PTraversal with a Fold
exist open fun exist(s: S, p: (A) -> Boolean): Boolean
Check whether at least one element satisfies the predicate.
extract open fun extract(): State<S, ListK<A>>
Extracts the focus A viewed through the PTraversal.
extractMap open fun <C> extractMap(f: (A) -> C): State<S, ListK<C>>
Extract and map the focus A viewed through the PTraversal and applies f to it.
find open fun find(s: S, p: (A) -> Boolean): Option<A>
Find the first target matching the predicate
fold open fun fold(M: Monoid<A>, s: S): A
Fold using the given Monoid instance.
foldMap open fun <R> foldMap(M: Monoid<R>, s: S, f: (A) -> R): R
open fun <R> foldMap(s: S, f: (A) -> R, M: Monoid<R>): R
Map each target to a Monoid and combine the results
forall open fun forall(s: S, p: (A) -> Boolean): Boolean
Check if forall targets satisfy the predicate
getAll open fun getAll(s: S): ListK<A>
Get all foci of the PTraversal
headOption open fun headOption(s: S): Option<A>
Find the first target or Option.None if no targets
isEmpty open fun isEmpty(s: S): Boolean
Check if there is no target
lastOption open fun lastOption(s: S): Option<A>
Find the first target or Option.None if no targets
modify open fun modify(s: S, f: (A) -> B): T
Modify polymorphically the target of a PTraversal with a function f
nonEmpty open fun nonEmpty(s: S): Boolean
Check if there is at least one target
plus open operator fun <C, D> plus(other: PTraversal<A, B, C, D>): PTraversal<S, T, C, D>
Plus operator overload to compose PTraversal with other opticsopen operator fun <C, D> plus(other: PSetter<A, B, C, D>): PSetter<S, T, C, D>
open operator fun <C, D> plus(other: POptional<A, B, C, D>): PTraversal<S, T, C, D>
open operator fun <C, D> plus(other: PLens<A, B, C, D>): PTraversal<S, T, C, D>
open operator fun <C, D> plus(other: PPrism<A, B, C, D>): PTraversal<S, T, C, D>
open operator fun <C, D> plus(other: PIso<A, B, C, D>): PTraversal<S, T, C, D>
open operator fun <C> plus(other: Fold<A, C>): Fold<S, C>
set open fun set(s: S, b: B): T
Set polymorphically the target of a PTraversal with a value
size open fun size(s: S): Int
Calculate the number of targets in the PTraversal
toState open fun toState(): State<S, ListK<A>>
Transforms a PTraversal into a State. Alias for extract.

Companion Object Functions

invoke operator fun <K, V> invoke(): MapTraversal<K, V>
Operator overload to instantiate typeclass instance.

Extension Properties

some val <T, S> Traversal<T, Option<S>>.some: Traversal<T, S>
DSL to compose a Prism with focus arrow.core.Some with a Traversal with a focus of Option<S>

Extension Functions

assign 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> 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> Traversal<S, A>.assign_(a: A): State<S, Unit>
Assign the focus A viewed through the Traversal and ignores both values.
at 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.
every fun <T, S, A> Traversal<T, S>.every(EA: Each<S, A>): Traversal<T, A>
DSL to compose Each with a Traversal for a structure S to see all its foci A
index 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
update 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> 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> Traversal<S, A>.update_(f: (A) -> A): State<S, Unit>
Update the focus A viewed through the Traversal and ignores both values