@markandrus/effect-derive
Version:
Derive Covariant (Functor), Foldable, and Traversable instances, as well as base functors, for algebraic data types (ADTs)
11 lines (10 loc) • 439 B
TypeScript
import { type Covariant } from '@effect/typeclass/Covariant';
import { type Kind, type TypeLambda } from 'effect/HKT';
export type Free<F extends TypeLambda, R, O, E, A> = {
type: 'Pure';
a: A;
} | {
type: 'Free';
fa: Kind<F, R, O, E, Free<F, R, O, E, A>>;
};
export declare const mapComposition: <F extends TypeLambda>(F: Covariant<F>) => <R, O, E, A, B>(self: Free<F, R, O, E, A>, f: (a: A) => B) => Free<F, R, O, E, B>;