maybetyped
Version:
Well-typed functional Maybe monad
17 lines (16 loc) • 616 B
TypeScript
import Maybe, { MatchType, Nil } from "./maybe";
export default class None<T> extends Maybe<T> {
protected constructor();
static none<T>(): None<T>;
expect(msg?: string | Error): T;
caseOf<R>(funcs: MatchType<T, R>): Maybe<R>;
map<U>(): Maybe<U>;
tap(): Maybe<T>;
flatMap<U>(): Maybe<U>;
orElse<U>(def: U | (() => U)): T | U;
or<U>(other: Maybe<U> | (() => Maybe<U>)): Maybe<T | U>;
eq(other: Maybe<T>): boolean;
join<U, R>(f: (x: T, y: U) => R | Nil, other: Maybe<U>): Maybe<R>;
asNullable(): T | null;
}
export declare const none: <T>() => Maybe<T>;