/** * This file contains the These algebraic data type. These is a sort of * combination of Either and Pair. It can represent a complete failure or a * partial failure. * * @module These * @since 2.0.0 */ import "./_dnt.polyfills.js"; import type { $, Kind, Out } from "./kind.js"; import type { Applicable } from "./applicable.js"; import type { Bimappable } from "./bimappable.js"; import type { Combinable } from "./combinable.js"; import type { Flatmappable } from "./flatmappable.js"; import type { Initializable } from "./initializable.js"; import type { Mappable } from "./mappable.js"; import type { Foldable } from "./foldable.js"; import type { Showable } from "./showable.js"; import type { Traversable } from "./traversable.js"; import * as E from "./either.js"; /** * @since 2.0.0 */ export type Left = E.Left; /** * @since 2.0.0 */ export type Right = E.Right; /** * @since 2.0.0 */ export type Both = { tag: "Both"; left: B; right: A; }; /** * @since 2.0.0 */ export type These = Left | Right | Both; /** * @since 2.0.0 */ export interface KindThese extends Kind { readonly kind: These, Out>; } /** * @since 2.0.0 */ export interface KindRightThese extends Kind { readonly kind: These>; } /** * @since 2.0.0 */ export declare function left(left: B): These; /** * @since 2.0.0 */ export declare function right(right: A): These; /** * @since 2.0.0 */ export declare function both(left: B, right: A): These; /** * @since 2.0.0 */ export declare function match(onLeft: (b: B) => O, onRight: (a: A) => O, onBoth: (b: B, a: A) => O): (ta: These) => O; /** * @since 2.0.0 */ export declare function isLeft(ta: These): ta is Left; /** * @since 2.0.0 */ export declare function isRight(ta: These): ta is Right; /** * @since 2.0.0 */ export declare function isBoth(ta: These): ta is Both; /** * @since 2.0.0 */ export declare function wrap(a: A): These; /** * @since 2.0.0 */ export declare function fail(b: B): These; /** * @since 2.0.0 */ export declare function map(fai: (a: A) => I): (ta: These) => These; /** * @since 2.0.0 */ export declare function mapSecond(fbj: (b: B) => J): (ta: These) => These; /** * @since 2.0.0 */ export declare function fold(foao: (o: O, a: A) => O, o: O): (ta: These) => O; /** * @since 2.0.0 */ export declare function traverse(A: Applicable): (favi: (a: A) => $) => (ta: These) => $, J, K], [L], [M]>; /** * @since 2.0.0 */ export declare function getShowableThese(SB: Showable, SA: Showable): Showable>; /** * @since 2.0.0 */ export declare function getCombinableThese(SA: Combinable, SB: Combinable): Combinable>; /** * @since 2.0.0 */ export declare function getInitializableThese(IA: Initializable, IB: Initializable): Initializable>; /** * @since 2.0.0 */ export declare function getFlatmappableRight({ combine }: Combinable): Flatmappable>; /** * @since 2.0.0 */ export declare const BimappableThese: Bimappable; /** * @since 2.0.0 */ export declare const MappableThese: Mappable; /** * @since 2.0.0 */ export declare const FoldableThese: Foldable; /** * @since 2.0.0 */ export declare const TraversableThese: Traversable;