Recursive

advanced

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

Functor#project

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>>

Functor#projectT

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>>

Functor#cata

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

Laws

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.recursion.data Fix, Mu, Nu

Hierarchy