The recursive typeclass abstracts out the ability to recursively fold a structure. See Intro to Recursion Schemes for an introduction to how it works.

Main Combinators


Given a Functor F, creates a Coalgebra which expands an F into a Kind<T, F>.

fun <F> Functor<F>.project(): Coalgebra<F, Kind<T, F>>


The implementation for project; takes a Kind<T, F> and returns a Kind<F, Kind<T, F>>.

fun <F> Functor<F>.projectT(tf: Kind<T, F>): Kind<F, Kind<T, F>>


Fold generalized over any Recursive T for any Functor F (wrapped in an Eval for stack safety).

fun <F, A> Functor<F>.cata(tf: Kind<T, F>, alg: Algebra<F, Eval<A>>): A


Arrow provides RecursiveLaws in the form of test cases for internal verification of lawful instances and third party apps creating their own Recursive instances.

Data types

Arrow provides three datatypes that are instances of Recursive, each modeling a different way of defining recursion.

Module Data types
arrow.core Either, Id, Ior, ListK, NonEmptyList, Option, SequenceK, Validated Cofree, Free Fix, Mu, Nu

Type Class Hierarchy

Do you like Arrow?

Arrow Org