/** * adapted from https://github.com/gcanti/fp-ts */ import { HKT } from "@tsplus/stdlib/prelude/HKT"; import { Maybe } from "@tsplus/stdlib/data/Maybe/definition"; /** * @tsplus type Either */ export type Either = Left | Right; export interface EitherF extends HKT { readonly type: Either; } export interface EitherFixedLeftF extends HKT { readonly type: HKT.Kind; } /** * @tsplus type Either.Ops */ export interface EitherOps { $: EitherAspects; } export declare const Either: EitherOps; /** * @tsplus type Either.Aspects */ export interface EitherAspects { } export declare namespace Either { type HKT = EitherF; type FixedLeftHKT = EitherFixedLeftF; } /** * @tsplus type Either.Left */ export interface Left { readonly _tag: "Left"; readonly left: E; } /** * @tsplus type Either.Right */ export interface Right { readonly _tag: "Right"; readonly right: A; } /** * @tsplus unify Either * @tsplus unify Either.Left * @tsplus unify Either.Right */ export declare function unifyEither>(self: X): Either ? EX : never, X extends Right ? AX : never>; /** * Returns `true` if the `Either` is an instance of `Left`, `false` otherwise. * @tsplus fluent Either isLeft * @tsplus location "@tsplus/stdlib/data/Either/definition" */ export declare function isLeft(ma: Either): ma is Left; /** * Returns `true` if the `Either` is an instance of `Right`, `false` otherwise. * @tsplus fluent Either isRight * @tsplus location "@tsplus/stdlib/data/Either/definition" */ export declare function isRight(ma: Either): ma is Right; /** * @tsplus getter Either left * @tsplus location "@tsplus/stdlib/data/Either/definition" */ export declare function getLeft(self: Either): Maybe; /** * @tsplus static Either.Ops isEither * @tsplus location "@tsplus/stdlib/data/Either/definition" */ export declare function isEither(u: unknown): u is Either; /** * @tsplus getter Either right * @tsplus location "@tsplus/stdlib/data/Either/definition" */ export declare function getRight(self: Either): Maybe; /** * Constructs a new `Either` holding a `Right` value. This usually represents a * successful value due to the right bias of this structure. * @tsplus static Either.Ops right * @tsplus static Either.Ops __call * @tsplus location "@tsplus/stdlib/data/Either/definition" */ export declare function right(a: A): Either; /** * Constructs a new `Either` holding a `Right` value. This usually represents a * successful value due to the right bias of this structure. * @tsplus static Either.Ops rightW * @tsplus location "@tsplus/stdlib/data/Either/definition" */ export declare function rightW(a: A): Either; /** * Constructs a new `Either` holding a `Left` value. This usually represents a * failure, due to the right-bias of this structure. * @tsplus static Either.Ops left * @tsplus location "@tsplus/stdlib/data/Either/definition" */ export declare function left(e: E): Either; /** * Constructs a new `Either` holding a `Left` value. This usually represents a * failure, due to the right-bias of this structure. * @tsplus static Either.Ops leftW * @tsplus location "@tsplus/stdlib/data/Either/definition" */ export declare function leftW(e: E): Either; /** * Widen left side `Either[E, A] => Either[E | E1, A]`. * @tsplus getter Either widenE * @tsplus macro identity * @tsplus location "@tsplus/stdlib/data/Either/definition" */ export declare function widenE_(self: Either): Either; /** * Widen left side `Either[E, A] => Either[E | E1, A]`. * @tsplus static Either.Aspects widenE * @tsplus location "@tsplus/stdlib/data/Either/definition" */ export declare function widenE(): (self: Either) => Either; /** * Widen left side `Either[E, A] => Either[E | E1, A]`. * @tsplus getter Either widenA * @tsplus macro identity * @tsplus location "@tsplus/stdlib/data/Either/definition" */ export declare function widenA_(self: Either): Either; /** * Widen right side `Either[E, A] => Either[E, A | A1]`. * @tsplus static Either.Aspects widenA * @tsplus location "@tsplus/stdlib/data/Either/definition" */ export declare function widenA(): (self: Either) => Either; /** * @tsplus operator Either == * @tsplus location "@tsplus/stdlib/data/Either/definition" */ export declare function equals(a: Either, b: Either): boolean; //# sourceMappingURL=definition.d.ts.map