/** * @tsplus type Recursive */ export interface Recursive { readonly caseValue: HKT.Kind> } /** * @tsplus type Recursive/Ops */ export interface RecursiveOps { $: RecursiveAspects } export const Recursive: RecursiveOps = { $: {} } /** * @tsplus type Recursive/Aspects */ export interface RecursiveAspects {} export declare namespace Recursive { /** * A function operating on a single level of a recursive structure, with its recursive term(s) * replaced by the result of the function's application on each child. a.k.a `F-Algebra` */ export type Fn = (r: HKT.Kind) => Z export type FnM = ( r: HKT.Kind ) => HKT.Kind /** * A function operating on a single level of a recursive structure. * The value of the computation at the previous step is provided, along * with the *original* recursive term. This is for breadth-first (left) folds */ export type FoldDownFn = (accum: Z, r: Recursive) => Z } /** * @tsplus static Recursive/Aspects unfix * @tsplus pipeable Recursive unfix */ export function unfixRecursive() { return ( self: Recursive ): HKT.Kind> => self.caseValue } /** * @tsplus static Recursive/Ops __call * @tsplus static Recursive/Ops make * @tsplus static Recursive/Ops fix */ export function makeRecursive( caseValue: HKT.Kind> ): Recursive { return { caseValue } }