arrow-core-data / arrow.typeclasses / Semialign

Semialign

interface Semialign<F> : Functor<F>

A type class used for aligning of functors with non-uniform shapes.

Note: Instances need to override either one of align/unlign here, otherwise a Stackoverflow exception will occur at runtime!

Functions

align Combines two structures by taking the union of their shapes and using Ior to hold the elements.open fun <A, B> align(a: Kind<F, A>, b: Kind<F, B>): Kind<F, Ior<A, B>>
alignWith Combines two structures by taking the union of their shapes and combining the elements with the given function.open fun <A, B, C> alignWith(a: Kind<F, A>, b: Kind<F, B>, fa: (Ior<A, B>) -> C): Kind<F, C>
padZip Align two structures as in zip, but filling in blanks with None.open fun <A, B> Kind<F, A>.padZip(other: Kind<F, B>): Kind<F, Tuple2<Option<A>, Option<B>>>
padZipWith Align two structures as in zipWith, but filling in blanks with None.open fun <A, B, C> Kind<F, A>.padZipWith(other: Kind<F, B>, fa: (Option<A>, Option<B>) -> C): Kind<F, C>
salign aligns two structures and combine them with the given Semigroups ‘+’open fun <A> Kind<F, A>.salign(SG: Semigroup<A>, other: Kind<F, A>): Kind<F, A>

Inheritors

Align The Align type class extends the Semialign type class with a value empty(), which acts as a unit in regards to align.interface Align<F> : Semialign<F>
Unalign Unalign extends Semialign thereby supporting an inverse function to align: It splits a union shape into a tuple representing the component parts.interface Unalign<F> : Semialign<F>
Zip Zip is a typeclass that extends a Functor by providing a zip operation that takes the intersection of non-uniform shapes.interface Zip<F> : Semialign<F>

Do you like Arrow?

Arrow Org
<