/** * The `Chain` type class extends the `Apply` type class with a `chain` operation which composes computations in * sequence, using the return value of one computation to determine the next computation. * * Instances must satisfy the following law in addition to the `Apply` laws: * * 1. Associativity: `F.chain(F.chain(fa, afb), bfc) <-> F.chain(fa, a => F.chain(afb(a), bfc))` * * Note. `Apply`'s `ap` can be derived: `(fab, fa) => F.chain(fab, f => F.map(fa, f))` * * @since 2.0.0 */ import { Apply, Apply1, Apply2, Apply2C, Apply3, Apply4, Apply3C } from './Apply' import { HKT, Kind, Kind2, Kind3, Kind4, URIS, URIS2, URIS3, URIS4 } from './HKT' /** * @category type classes * @since 2.0.0 */ export interface Chain extends Apply { readonly chain: (fa: HKT, f: (a: A) => HKT) => HKT } /** * @category type classes * @since 2.0.0 */ export interface Chain1 extends Apply1 { readonly chain: (fa: Kind, f: (a: A) => Kind) => Kind } /** * @category type classes * @since 2.0.0 */ export interface Chain2 extends Apply2 { readonly chain: (fa: Kind2, f: (a: A) => Kind2) => Kind2 } /** * @category type classes * @since 2.0.0 */ export interface Chain2C extends Apply2C { readonly chain: (fa: Kind2, f: (a: A) => Kind2) => Kind2 } /** * @category type classes * @since 2.0.0 */ export interface Chain3 extends Apply3 { readonly chain: (fa: Kind3, f: (a: A) => Kind3) => Kind3 } /** * @category type classes * @since 2.2.0 */ export interface Chain3C extends Apply3C { readonly chain: (fa: Kind3, f: (a: A) => Kind3) => Kind3 } /** * @category type classes * @since 2.0.0 */ export interface Chain4 extends Apply4 { readonly chain: (fa: Kind4, f: (a: A) => Kind4) => Kind4 }