/** * @since 0.1.3 */ import { Applicative2 } from 'fp-ts/lib/Applicative' import { Apply2 } from 'fp-ts/lib/Apply' import { Functor2 } from 'fp-ts/lib/Functor' import { HKT, Kind, Kind2, Kind3, URIS, URIS2, URIS3 } from 'fp-ts/lib/HKT' import { Monad, Monad1, Monad2, Monad2C, Monad3 } from 'fp-ts/lib/Monad' /** * @data * @constructor Pure * @constructor Impure * @category model * @since 0.1.3 */ export declare type Free = Pure | Impure interface Pure<_F, A> { readonly _tag: 'Pure' readonly value: A } interface Impure { readonly _tag: 'Impure' readonly fx: HKT readonly f: (x: X) => Free } /** * Lift an impure value described by the generating type constructor `F` into the free monad * * @category constructors * @since 0.1.3 */ export declare const liftF: (fa: HKT) => Free /** * @category destructors * @since 0.1.3 */ export interface FoldFree3 { (nt: (fa: Kind3) => Kind3, fa: Free): Kind3 (nt: (fa: Kind2) => Kind3, fa: Free): Kind3 (nt: (fa: Kind) => Kind3, fa: Free): Kind3 } /** * @category destructors * @since 0.1.3 */ export interface FoldFree2 { (nt: (fa: Kind2) => Kind2, fa: Free): Kind2 (nt: (fa: Kind) => Kind2, fa: Free): Kind2 } /** * @category destructors * @since 0.1.3 */ export interface FoldFree2C { (nt: (fa: Kind2) => Kind2, fa: Free): Kind2 (nt: (fa: Kind) => Kind2, fa: Free): Kind2 } /** * Perform folding of a free monad using given natural transformation as an interpreter * * @category destructors * @since 0.1.3 */ export declare function foldFree(M: Monad3): FoldFree3 export declare function foldFree(M: Monad2): FoldFree2 export declare function foldFree(M: Monad2C): FoldFree2C export declare function foldFree( M: Monad1 ): (nt: (fa: Kind) => Kind, fa: Free) => Kind export declare function foldFree( M: Monad ): (nt: (fa: HKT) => HKT, fa: Free) => HKT /** * Use a natural transformation to change the generating type constructor of a free monad * * @category combinators * @since 0.1.3 */ export declare function hoistFree( nt: (fa: Kind3) => Kind3 ): (fa: Free) => Free export declare function hoistFree( nt: (fa: Kind2) => Kind2 ): (fa: Free) => Free export declare function hoistFree( nt: (fa: Kind) => Kind ): (fa: Free) => Free export declare function hoistFree(nt: (fa: HKT) => HKT): (fa: Free) => Free /** * @category Functor * @since 0.1.18 */ export declare const map: (f: (a: A) => B) => (fa: Free) => Free /** * @category Apply * @since 0.1.18 */ export declare const ap: (fa: Free) => (fab: Free B>) => Free /** * @category Monad * @since 0.1.18 */ export declare const chain: (f: (a: A) => Free) => (ma: Free) => Free /** * @category Monad * @since 0.1.18 */ export declare const flatten: (mma: Free>) => Free /** * @category Applicative * @since 0.1.18 */ export declare const of: (a: A) => Free /** * @category instances * @since 0.1.3 */ export declare const URI = 'Free' /** * @category instances * @since 0.1.3 */ export declare type URI = typeof URI declare module 'fp-ts/lib/HKT' { interface URItoKind2 { Free: Free } } /** * @category instances * @since 0.1.18 */ export declare const Functor: Functor2 /** * @category instances * @since 0.1.18 */ export declare const Applicative: Applicative2 /** * @category instances * @since 0.1.18 */ export declare const Apply: Apply2 /** * Monad instance for Free * * @category instances * @since 0.1.3 */ export declare const free: Monad2 /** * Check if given Free instance is Pure * * @since 0.1.3 */ export declare const isPure: (fa: Free) => fa is Pure /** * Check if given Free instance is Impure * * @since 0.1.3 */ export declare const isImpure: (fa: Free) => fa is Impure export {}