ChainTraversable

Traversable instance for Chain.

Inheritors

Functions

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

Applies f to every value inside v.

Link copied to clipboard
open 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 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 override fun <A, B> imap(f: (A) -> B, g: (B) -> A, v: K1<Chain.T, A>): K1<Chain.T, B>

Implements Invariant.imap by ignoring the backward function.

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 fun <A> length(v: K1<Chain.T, A>): Int

Counts the elements.

Link copied to clipboard
open fun <G, A> sequence(applicative: Applicative<G>, v: K1<Chain.T, K1<G, A>>): K1<G, K1<Chain.T, A>>

Turns a structure of effects inside out into an effect producing a structure.

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

Collects the elements into a list, preserving order.

Link copied to clipboard
open override fun <G, A, B> traverse(applicative: Applicative<G>, f: (A) -> K1<G, B>, v: K1<Chain.T, A>): K1<G, K1<Chain.T, B>>

Applies the effectful f to each element and combines the effects with applicative.