arrow-optics / arrow.optics.extensions / ListKCons

ListKCons

@extension interface ListKCons<A> : Cons<ListK<A>, A>

Cons instance definition for ListK.

Functions

cons open fun cons(): Prism<ListK<A>, Tuple2<A, ListK<A>>>
Provides a Prism between S and its first element A and tail S.

Inherited Functions

cons open infix fun A.cons(tail: S): S
Prepend an element A to the first element of S.
firstOption open fun firstOption(): Optional<S, A>
Provides an Optional between S and its first element A.
tailOption open fun tailOption(): Optional<S, S>
Provides an Optional between S and its tail S.
uncons open fun S.uncons(): Option<Tuple2<A, S>>
Deconstruct an S to its optional first element A and tail S.