import { MapFunction, SubscribeFunction, Consumer } from "./frp-common";
import { Future } from "./Future";
import { Stream } from "./Stream";
/**
 * A behavior is a value that changes over time. Conceptually it can
 * be though of as a function from time to a value. I.e. `type
 * Behavior<A> = (t: Time) => A`.
 */
export declare abstract class Behavior<A> {
    cbListeners: ((b: A) => void)[];
    listeners: Consumer<any>[];
    last: A;
    pushing: boolean;
    publish(b: A): void;
    abstract push(a: any, changed: Behavior<any>): void;
    abstract pull(): A;
    def: Behavior<A>;
    map<B>(fn: MapFunction<A, B>): Behavior<B>;
    of: <A>(v: A) => Behavior<A>;
    static of: <A>(v: A) => Behavior<A>;
    chain<B>(fn: (a: A) => Behavior<B>): Behavior<B>;
    addListener(listener: Consumer<any>): void;
    unlisten(listener: Consumer<any>): void;
}
export declare function of<B>(val: B): Behavior<B>;
export declare function at<B>(b: Behavior<B>): B;
/**
 * A placeholder behavior is a behavior without any value. It is used
 * to do value recursion in `./framework.ts`.
 * @private
 */
export declare class PlaceholderBehavior<B> extends Behavior<B> {
    private source;
    constructor();
    push(v: B): void;
    pull(): B;
    replaceWith(b: Behavior<B>): void;
}
export declare function placeholder(): PlaceholderBehavior<any>;
/**
 * Take a behavior `b` of booleans and return a behavior that for time
 * `t` contains a future that occurs when `b` is true after `t`.
 * @param b - A boolean valued behavior.
 */
export declare function when(b: Behavior<boolean>): Behavior<Future<{}>>;
export declare function snapshot<A>(behavior: Behavior<A>, future: Future<any>): Behavior<Future<A>>;
/**
 * From an initial behavior and a future of a behavior `switcher`
 * creates a new behavior that acts exactly like `initial` until
 * `next` occurs after which it acts like the behavior it contains.
 */
export declare function switcher<A>(init: Behavior<A>, next: Future<Behavior<A>>): Behavior<A>;
/**
 * Creates a Behavior whose value is the last occurrence in the stream.
 * @param initial the initial value that the behavior has
 * @param steps the stream that will change the value of the behavior
 */
export declare function stepper<B>(initial: B, steps: Stream<B>): Behavior<B>;
export declare function scan<A, B>(fn: (a: A, b: B) => B, init: B, source: Stream<A>): Behavior<Behavior<B>>;
export declare function fromFunction<B>(fn: () => B): Behavior<B>;
export declare function sink<A>(initialValue: A): Behavior<A>;
export declare function subscribe<A>(fn: SubscribeFunction<A>, b: Behavior<A>): void;
export declare function publish<A>(a: A, b: Behavior<A>): void;
export declare function map<A, B>(fn: MapFunction<A, B>, b: Behavior<A>): Behavior<B>;
export declare function ap<A, B>(fnB: Behavior<(a: A) => B>, valB: Behavior<A>): Behavior<B>;
export declare function isBehavior(b: any): b is Behavior<any>;
