/** * Naive "either or" type implementation. * * This differs from other implementations mostly in how relaxed the type inferrence is. * * Again, this could easily be replaced with something from e.g. fp-ts, but the goal is * to have a single "prelude/stdlib" here. * * * @module * @deprecated use effect instead */ export type Either = { __tag: "left"; left: Left; } | { __tag: "right"; right: Right; }; export type Left> = E extends Either ? Left : never; export type Right> = E extends Either ? Right : never; export declare const left: (left: Left) => Either; export declare const right: (right: Right) => Either; export declare const map: (fn: (value: R1) => R2) => (either: Either) => Either; export declare const flatMap: >(fn: (value: R1) => E) => (either: Either) => Either>, Right>>; export declare const match: (onLeft: (left: Left) => T, onRight: (right: Right) => T) => (either: Either) => T; export declare const getOrElse: (fallback: (left: L) => F) => (either: Either) => R | F; export declare const alt: (second: Either) => (first: Either) => Either;