PSetter

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

A Setter is an optic that allows to see into a structure and set or modify its focus.

A (polymorphic) PSetter is useful when setting or modifying a value for a constructed type i.e. PSetter, List, Int, String>

A PSetter is a generalisation of a functor. Functor::map (fa: Kind, f: (A) -> B): Kind PSetter::modify(s: S, f: (A) -> B): T

Parameters

S

the source of a PSetter

T

the modified source of a PSetter

A

the focus of a PSetter

B

the modified focus of a PSetter

Inheritors

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
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>

Functions

Link copied to clipboard
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
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

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

Link copied to clipboard
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> 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
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 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>
Link copied to clipboard
open fun set(source: S, focus: B): T

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