ChainFoldable

Foldable instance for Chain.

Inheritors

Functions

Link copied to clipboard
open override fun <A, B> foldl(initial: B, f: (B, A) -> B, v: K1<Chain.T, A>): B

Left-associative fold: f(f(f(initial, a1), a2), a3).

Link copied to clipboard
open fun <A, M : Monoid<*, M>> foldMap(type: Class<M>, f: (A) -> M, v: K1<Chain.T, A>): M

Maps every element to the monoid M and combines the results.

Link copied to clipboard
open override fun <A, B> foldr(initial: B, f: (A, B) -> B, v: K1<Chain.T, A>): B

Right-associative fold: f(a1, f(a2, f(a3, initial))).

Link copied to clipboard
open fun <A> isEmpty(v: K1<Chain.T, A>): Boolean

Returns true when there are no elements.

Link copied to clipboard
open override fun <A> length(v: K1<Chain.T, A>): Int

Counts the elements.

Link copied to clipboard
open override fun <A> toList(v: K1<Chain.T, A>): List<A>

Collects the elements into a list, preserving order.