arrow-optics / arrow.optics.extensions / ListCons

ListCons

interface ListCons<A> : Cons<List<A>, A>

Cons instance definition for List.

Functions

cons open fun cons(): Prism<List<A>, Tuple2<A, List<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.

Companion Object Functions

invoke operator fun <A> invoke(): ListCons<A>