arrow-optics / arrow.optics.typeclasses / Cons

Cons

interface Cons<S, A>

Functions

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

Companion Object Functions

fromIso Lift an instance of Cons using an Iso.fun <S, A, B> fromIso(C: Cons<A, B>, iso: Iso<S, A>): Cons<S, B>
invoke operator fun <S, A> invoke(prism: Prism<S, Tuple2<A, S>>): Cons<S, A>
list Cons instance definition for List.fun <A> list(): Cons<List<A>, A>
string Cons instance for String.fun string(): Cons<String, Char>

Inheritors

ListCons Cons instance definition for List.interface ~~ListCons~~<A> : Cons<List<A>, A>
ListKCons Cons instance definition for ListK.interface ~~ListKCons~~<A> : Cons<ListK<A>, A>
StringCons interface ~~StringCons~~ : Cons<String, Char>

Do you like Arrow?

Arrow Org
<