Align

interface Align<T> : Semialign<T> (source)

A Semialign with an empty structure nil that is the identity of align.

Laws:

  • Right identity: align(x, nil()) == fmap({ Ior.left(it) }, x)

  • Left identity: align(nil(), x) == fmap({ Ior.right(it) }, x)

See also

Inheritors

Functions

Link copied to clipboard
open fun <A, B> align(a: K1<T, A>, b: K1<T, B>): K1<T, Ior<A, B>>

Pairs up the values of a and b position by position, keeping unmatched values.

Link copied to clipboard
abstract fun <A, B, C> alignWith(f: (Ior<A, B>) -> C, a: K1<T, A>, b: K1<T, B>): K1<T, C>

Combines a and b position by position with f, which receives the values present at each position.

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

Applies f to every value inside v.

Link copied to clipboard
open override fun <A, B> imap(f: (A) -> B, g: (B) -> A, v: K1<T, A>): K1<T, B>

Implements Invariant.imap by ignoring the backward function.

Link copied to clipboard
abstract fun <A> nil(): K1<T, A>

The empty structure.