PSetter

fun interface PSetter<S, T, A, B>

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

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

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
open fun lift(map: (A) -> B): (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: (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 b.

Inheritors

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