arrow-optics / arrow.optics / Getter
interface Getter<S, A> :
GetterOf
<S, A>
asFold | open fun asFold(): Fold <S, A> |
choice | Join two Getter with the same focusopen infix fun <C> choice(other: Getter <C, A>): Getter <Either<S, C>, A> |
compose | Compose a Getter with a Getteropen infix fun <C> compose(other: Getter <A, C>): Getter <S, C> Compose a Getter with a Lens open infix fun <C> compose(other: Lens <A, C>): Getter <S, C> Compose a Getter with a Iso open infix fun <C> compose(other: Iso <A, C>): Getter <S, C> Compose a Getter with a Fold open infix fun <C> compose(other: Fold <A, C>): Fold <S, C> |
exist | Check if the focus A satisfies the predicate p.open fun exist(s: S, p: (A) -> Boolean ): Boolean |
find | Find the focus A if it satisfies the predicate p.open fun find(s: S, p: (A) -> Boolean ): Option<A> |
first | Create a product of the Getter and a type Copen fun <C> first(): Getter <Tuple2<S, C>, Tuple2<A, C>> |
get | Get the focus of a Getterabstract fun get(s: S): A |
left | Create a sum of the Getter and type Copen fun <C> left(): Getter <Either<S, C>, Either<A, C>> |
plus | Plus operator overload to compose optionalsopen operator fun <C> plus(other: Getter <A, C>): Getter <S, C> open operator fun <C> plus(other: Lens <A, C>): Getter <S, C> open operator fun <C> plus(other: Iso <A, C>): Getter <S, C> open operator fun <C> plus(other: Fold <A, C>): Fold <S, C> |
right | Create a sum of type C and the Getteropen fun <C> right(): Getter <Either<C, S>, Either<C, A>> |
second | Create a product of type C and the Getteropen fun <C> second(): Getter <Tuple2<C, S>, Tuple2<C, A>> |
split | Pair two disjoint Getteropen infix fun <C, D> split(other: Getter <C, D>): Getter <Tuple2<S, C>, Tuple2<A, D>> |
zip | Zip two Getter optics with the same source Sopen infix fun <C> zip(other: Getter <S, C>): Getter <S, Tuple2<A, C>> |
codiagonal | Getter that takes either S or S and strips the choice of S.fun <S> codiagonal(): Getter <Either<S, S>, S> |
id | fun <S> id(): Getter <S, S> |
at | DSL to compose At with a Getter for a structure S to focus in on A at given index I.fun <T, S, I, A> Getter <T, S>.at(AT: At <S, I, A>, i: I): Getter <T, A> |
Do you like Arrow?
✖