import { IO } from "jabz/io"; import { Monad } from "jabz/monad"; import { Future } from "./Future"; import { Behavior } from "./Behavior"; import { Stream } from "./Stream"; /** * The Now monad represents a computation that takes place in a given * moment and where the moment will always be now when the computation * is run. */ export declare abstract class Now implements Monad { abstract run(): A; of(b: B): Now; static of(b: B): Now; chain(f: (a: A) => Now): Now; static multi: boolean; multi: boolean; flatten: () => Now; map: (f: (a: A) => B) => Now; mapTo: (b: B) => Now; ap: (a: Now<(a: A) => B>) => Now; lift: (f: Function, ...ms: any[]) => Now; } /** * Run an asynchronous IO action and return a future in the Now monad * that resolves with the eventual result of the IO action once it * completes. This function is what allows the Now monad to execute * imperative actions in a way that is pure and integrated with FRP. */ export declare function async(comp: IO): Now>; /** * Returns the current value of a behavior in the Now monad. This is * possible because computations in the Now monad have an associated * point in time. */ export declare function sample(b: Behavior): Now; /** * Takes a stream of `IO` actions and return a stream in a now * computation. When run the now computation executes each `IO` action * and delivers their result into the created stream. */ export declare function performStream(s: Stream>): Now>; /** * Convert a future now computation into a now computation of a * future. This function is what allows a Now-computation to reach * beyond the current moment that it is running in. */ export declare function plan(future: Future>): Now>; /** * Run the given Now-computation. The returned promise resolves once * the future that is the result of running the now computation * occurs. This is an impure function and should not be used in normal * application code. */ export declare function runNow(now: Now>): Promise;