arrow-optics / arrow.optics.extensions / ListSnoc


interface ListSnoc<A> : Snoc<List<A>, A>

Snoc instance definition for List.

Inherited Properties

init open val S.init: Option<S>
Selects all elements except the last.


snoc open fun snoc(): Prism<List<A>, Tuple2<List<A>, A>>
Provides a Prism between a S and its init and last element A.

Inherited Functions

initOption open fun initOption(): Optional<S, S>
Provides an Optional between S and its init S.
lastOption open fun lastOption(): Optional<S, A>
Provides an Optional between S and its last element A.
snoc open infix fun S.snoc(last: A): S
Append an element A to S.
unsnoc open fun S.unsnoc(): Option<Tuple2<S, A>>
Deconstruct an S between its init and last element.

Companion Object Functions

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