arrow-optics / arrow.optics / 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.
Traversal is a generalisation of arrow.Traverse and can be seen as a representation of modifyF. all methods are written in terms of modifyF
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
every | DSL to compose Traversal with a Lens for a structure S to see all its foci Aopen val <U, V> PLens <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> PIso <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> PPrism <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> POptional <U, V, S, T>.every: PTraversal <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> PSetter <U, V, S, T>.every: PSetter <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> PTraversal <U, V, S, T>.every: PTraversal <U, V, A, B> DSL to compose Traversal with a Fold for a structure S to see all its foci A open val <U> Fold <U, S>.every: Fold <U, A> |
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 | Alias for fold.open fun combineAll(M: Monoid<A>, s: S): A |
compose | Compose a PTraversal with a PTraversalopen infix fun <C, D> compose(other: PTraversal <A, B, C, D>): PTraversal <S, T, C, D> Compose a PTraversal with a PSetter open infix fun <C, D> compose(other: PSetter <A, B, C, D>): PSetter <S, T, C, D> Compose a PTraversal with a POptional open infix fun <C, D> compose(other: POptional <A, B, C, D>): PTraversal <S, T, C, D> Compose a PTraversal with a PLens open infix fun <C, D> compose(other: PLens <A, B, C, D>): PTraversal <S, T, C, D> Compose a PTraversal with a PPrism open infix fun <C, D> compose(other: PPrism <A, B, C, D>): PTraversal <S, T, C, D> Compose a PTraversal with a PIso open infix fun <C, D> compose(other: PIso <A, B, C, D>): PTraversal <S, T, C, D> Compose a PTraversal with a Fold open infix fun <C> compose(other: Fold <A, C>): Fold <S, C> |
exist | Check whether at least one element satisfies the predicate.open fun exist(s: S, p: (A) -> Boolean ): Boolean |
find | Find the first target matching the predicateopen fun find(s: S, p: (A) -> Boolean ): Option<A> |
fold | Fold using the given Monoid instance.open fun fold(M: Monoid<A>, s: S): A |
foldMap | Map each target to a Monoid and combine the resultsopen 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 |
forall | Check if forall targets satisfy the predicateopen fun forall(s: S, p: (A) -> Boolean ): Boolean |
getAll | Get all foci of the PTraversalopen fun getAll(s: S): ListK<A> |
headOption | Find the first target or Option.None if no targetsopen fun headOption(s: S): Option<A> |
isEmpty | Check if there is no targetopen fun isEmpty(s: S): Boolean |
lastOption | Find the first target or Option.None if no targetsopen fun lastOption(s: S): Option<A> |
modify | Modify polymorphically the target of a PTraversal with a function fopen fun modify(s: S, f: (A) -> B): T |
modifyF | abstract fun <F> modifyF(FA: Applicative<F>, s: S, f: (A) -> Kind<F, B>): Kind<F, T> |
nonEmpty | Check if there is at least one targetopen fun nonEmpty(s: S): Boolean |
plus | Plus operator overload to compose PTraversal with other opticsopen operator fun <C, D> plus(other: PTraversal <A, B, C, D>): PTraversal <S, T, C, D> open 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 | Set polymorphically the target of a PTraversal with a valueopen fun set(s: S, b: B): T |
size | Calculate the number of targets in the PTraversalopen fun size(s: S): Int |
codiagonal | fun <S> codiagonal(): Traversal <Either<S, S>, S> |
either | Traversal for Either that has focus in each Either.Right.fun <L, R> either(): Traversal <Either<L, R>, R> |
fromTraversable | Construct a PTraversal from a Traverse instance.fun <T, A, B> fromTraversable(TT: Traverse<T>): PTraversal <Kind<T, A>, Kind<T, B>, A, B> |
id | fun <S> id(): PTraversal <S, S, S, S> |
invoke | PTraversal constructor from multiple getters of the same source.operator fun <S, T, A, B> invoke(get1: (S) -> A, get2: (S) -> A, set: (B, B, S) -> T): PTraversal <S, T, A, B> operator fun <S, T, A, B> invoke(get1: (S) -> A, get2: (S) -> A, get3: (S) -> A, set: (B, B, B, S) -> T): PTraversal <S, T, A, B> operator fun <S, T, A, B> invoke(get1: (S) -> A, get2: (S) -> A, get3: (S) -> A, get4: (S) -> A, set: (B, B, B, B, S) -> T): PTraversal <S, T, A, B> operator fun <S, T, A, B> invoke(get1: (S) -> A, get2: (S) -> A, get3: (S) -> A, get4: (S) -> A, get5: (S) -> A, set: (B, B, B, B, B, S) -> T): PTraversal <S, T, A, B> operator fun <S, T, A, B> invoke(get1: (S) -> A, get2: (S) -> A, get3: (S) -> A, get4: (S) -> A, get5: (S) -> A, get6: (S) -> A, set: (B, B, B, B, B, B, S) -> T): PTraversal <S, T, A, B> operator fun <S, T, A, B> invoke(get1: (S) -> A, get2: (S) -> A, get3: (S) -> A, get4: (S) -> A, get5: (S) -> A, get6: (S) -> A, get7: (S) -> A, set: (B, B, B, B, B, B, B, S) -> T): PTraversal <S, T, A, B> operator fun <S, T, A, B> invoke(get1: (S) -> A, get2: (S) -> A, get3: (S) -> A, get4: (S) -> A, get5: (S) -> A, get6: (S) -> A, get7: (S) -> A, get8: (S) -> A, set: (B, B, B, B, B, B, B, B, S) -> T): PTraversal <S, T, A, B> operator fun <S, T, A, B> invoke(get1: (S) -> A, get2: (S) -> A, get3: (S) -> A, get4: (S) -> A, get5: (S) -> A, get6: (S) -> A, get7: (S) -> A, get8: (S) -> A, get9: (S) -> A, set: (B, B, B, B, B, B, B, B, B, S) -> T): PTraversal <S, T, A, B> operator fun <S, T, A, B> invoke(get1: (S) -> A, get2: (S) -> A, get3: (S) -> A, get4: (S) -> A, get5: (S) -> A, get6: (S) -> A, get7: (S) -> A, get8: (S) -> A, get9: (S) -> A, get10: (S) -> A, set: (B, B, B, B, B, B, B, B, B, B, S) -> T): PTraversal <S, T, A, B> |
list | Traversal for List that focuses in each A of the source List.fun <A> list(): Traversal < List <A>, A> |
map | fun <K, V> map(): Traversal < Map <K, V>, V> |
nonEmptyList | Traversal for NonEmptyList that has focus in each A.fun <A> nonEmptyList(): Traversal <NonEmptyList<A>, A> |
option | Traversal for Option that has focus in each arrow.core.Some.fun <A> option(): Traversal <Option<A>, A> |
pair | Traversal to focus into the first and second value of a Pairfun <A> pair(): Traversal < Pair <A, A>, A> |
pPair | PTraversal to focus into the first and second value of a Pairfun <A, B> pPair(): PTraversal < Pair <A, A>, Pair <B, B>, A, B> |
pTriple | PTraversal to focus into the first, second and third value of a Triplefun <A, B> pTriple(): PTraversal < Triple <A, A, A>, Triple <B, B, B>, A, B> |
pTuple10 | PTraversal to focus into the first, second, third, fourth, fifth, sixth, seventh, eight, ninth and tenth value of a arrow.core.Tuple10fun <A, B> pTuple10(): PTraversal <Tuple10<A, A, A, A, A, A, A, A, A, A>, Tuple10<B, B, B, B, B, B, B, B, B, B>, A, B> |
pTuple4 | PTraversal to focus into the first, second, third and fourth value of a arrow.core.Tuple4fun <A, B> pTuple4(): PTraversal <Tuple4<A, A, A, A>, Tuple4<B, B, B, B>, A, B> |
pTuple5 | PTraversal to focus into the first, second, third, fourth and fifth value of a arrow.core.Tuple5fun <A, B> pTuple5(): PTraversal <Tuple5<A, A, A, A, A>, Tuple5<B, B, B, B, B>, A, B> |
pTuple6 | PTraversal to focus into the first, second, third, fourth, fifth and sixth value of a arrow.core.Tuple6fun <A, B> pTuple6(): PTraversal <Tuple6<A, A, A, A, A, A>, Tuple6<B, B, B, B, B, B>, A, B> |
pTuple7 | PTraversal to focus into the first, second, third, fourth, fifth, sixth and seventh value of a arrow.core.Tuple7fun <A, B> pTuple7(): PTraversal <Tuple7<A, A, A, A, A, A, A>, Tuple7<B, B, B, B, B, B, B>, A, B> |
pTuple8 | PTraversal to focus into the first, second, third, fourth, fifth, sixth, seventh and eight value of a arrow.core.Tuple8fun <A, B> pTuple8(): PTraversal <Tuple8<A, A, A, A, A, A, A, A>, Tuple8<B, B, B, B, B, B, B, B>, A, B> |
pTuple9 | PTraversal to focus into the first, second, third, fourth, fifth, sixth, seventh, eight and ninth value of a arrow.core.Tuple9fun <A, B> pTuple9(): PTraversal <Tuple9<A, A, A, A, A, A, A, A, A>, Tuple9<B, B, B, B, B, B, B, B, B>, A, B> |
sequence | fun <A> sequence(): Traversal < Sequence <A>, A> |
string | Traversal for String that focuses in each Char of the source String.fun string(): Traversal < String , Char > |
triple | Traversal to focus into the first, second and third value of a Triplefun <A> triple(): Traversal < Triple <A, A, A>, A> |
tuple10 | Traversal to focus into the first, second, third, fourth, fifth, sixth, seventh, eight, ninth and tenth value of a arrow.core.Tuple10fun <A> tuple10(): Traversal <Tuple10<A, A, A, A, A, A, A, A, A, A>, A> |
tuple4 | Traversal to focus into the first, second, third and fourth value of a arrow.core.Tuple4fun <A> tuple4(): Traversal <Tuple4<A, A, A, A>, A> |
tuple5 | Traversal to focus into the first, second, third, fourth and fifth value of a arrow.core.Tuple5fun <A> tuple5(): Traversal <Tuple5<A, A, A, A, A>, A> |
tuple6 | Traversal to focus into the first, second, third, fourth, fifth and sixth value of a arrow.core.Tuple6fun <A> tuple6(): Traversal <Tuple6<A, A, A, A, A, A>, A> |
tuple7 | Traversal to focus into the first, second, third, fourth, fifth, sixth and seventh value of a arrow.core.Tuple7fun <A> tuple7(): Traversal <Tuple7<A, A, A, A, A, A, A>, A> |
tuple8 | Traversal to focus into the first, second, third, fourth, fifth, sixth, seventh and eight value of a arrow.core.Tuple8fun <A> tuple8(): Traversal <Tuple8<A, A, A, A, A, A, A, A>, A> |
tuple9 | Traversal to focus into the first, second, third, fourth, fifth, sixth, seventh, eight and ninth value of a arrow.core.Tuple9fun <A> tuple9(): Traversal <Tuple9<A, A, A, A, A, A, A, A, A>, A> |
void | PTraversal that points to nothingfun <S, A> void(): PTraversal <S, S, A, A> |
some | DSL to compose a Prism with focus arrow.core.Some with a Traversal with a focus of Option<S>val <T, S> Traversal <T, Option<S>>.some: Traversal <T, S> |
at | 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> Traversal <T, S>.at(AT: At <S, I, A>, i: I): Traversal <T, A> |
every | DSL to compose Each with a Traversal for a structure S to see all its foci Afun <T, S, A> Traversal <T, S>.~~every~~(EA: Each <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> Traversal <T, S>.every(TR: Traversal <S, A>): Traversal <T, A> |
index | DSL to compose Index with a Traversal for a structure S to focus in on A at given index Ifun <T, S, I, A> Traversal <T, S>.index(ID: Index <S, I, A>, i: I): Traversal <T, A> |
Do you like Arrow?
✖