import { Option } from './option.js'; import { Mappable } from './mappable.js'; export declare function identity(x: T): T; export declare function toErrorConversion(x: unknown): Error; export declare type StepFunction = (state: any) => R; export declare type StepCondition = (state: any) => boolean; export interface Filterable> { filter(p: (x: T) => boolean): R; } export declare type MaybeWithFilter, R> = C extends Filterable> ? StepWithFilter : Step; export declare type TaskMaybeWithFilter> = C extends Filterable> ? TaskWithFilter : Task; export interface Step { readonly name: Option; invokeStep(state: any): R; } export declare type Task> = Step>; export declare class StepWithFilter implements Step { readonly name: Option; readonly f: StepFunction; readonly filter: Option; constructor(name: Option, f: StepFunction, filter: Option); if(condition: (state: any) => boolean): Step; invokeStep(state: Record): R; } export declare class TaskWithFilter> implements Task { readonly name: Option; readonly f: StepFunction>; readonly filter: Option; constructor(name: Option, f: StepFunction>, filter: Option); if(condition: (state: any) => boolean): Step>; invokeStep(state: Record): Promise; } export declare function step>(name: string, f: StepFunction): MaybeWithFilter; export declare function task>(name: string, f: StepFunction>): TaskMaybeWithFilter; export declare function forComprehension>(...steps: Step[]): { yield: (final: (state: any) => any) => C; }; export declare namespace forComprehension { function promise>(...steps: Task[]): { yield: (final: (state: any) => any) => Promise; }; }