/** * This file contains the SyncEither algebraic data type. SyncEither is an * lazy function that takes no inputs and returns an Either. The intuition of a * SyncEither is an IO call that can fail. * * @module SyncEither * @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 { Either } from "./either.js"; import type { Failable } from "./failable.js"; import type { Flatmappable } from "./flatmappable.js"; import type { Foldable } from "./foldable.js"; import type { Initializable } from "./initializable.js"; import type { Mappable } from "./mappable.js"; import type { Sync } from "./sync.js"; import type { Wrappable } from "./wrappable.js"; import * as E from "./either.js"; /** * @since 2.0.0 */ export type SyncEither = Sync>; /** * @since 2.0.0 */ export interface KindSyncEither extends Kind { readonly kind: SyncEither, Out>; } /** * @since 2.0.0 */ export interface KindSyncRight extends Kind { readonly kind: SyncEither>; } /** * @since 2.0.0 */ export declare function left(left: B): SyncEither; /** * @since 2.0.0 */ export declare function right(right: A): SyncEither; /** * @since 2.0.0 */ export declare function tryCatch(fa: () => A, onError: (error: unknown) => B): SyncEither; /** * @since 2.0.0 */ export declare function fromEither(ta: E.Either): SyncEither; /** * @since 2.0.0 */ export declare function fromSync(ta: Sync): SyncEither; /** * @since 2.0.0 */ export declare function wrap(a: A): SyncEither; /** * @since 2.0.0 */ export declare function fail(b: B): SyncEither; /** * @since 2.0.0 */ export declare function apply(ua: SyncEither): (ufai: SyncEither I>) => SyncEither; /** * @since 2.0.0 */ export declare function map(fai: (a: A) => I): (ta: SyncEither) => SyncEither; /** * @since 2.0.0 */ export declare function mapSecond(fbj: (b: B) => J): (ta: SyncEither) => SyncEither; /** * @since 2.0.0 */ export declare function flatmap(faui: (a: A) => SyncEither): (ua: SyncEither) => SyncEither; /** * @since 2.0.0 */ export declare function recover(fbui: (b: B) => SyncEither): (ua: SyncEither) => SyncEither; /** * @since 2.0.0 */ export declare function alt(tb: SyncEither): (ta: SyncEither) => SyncEither; /** * @since 2.0.0 */ export declare function fold(foao: (o: O, a: A) => O, o: O): (ta: SyncEither) => O; /** * @since 2.0.0 */ export declare function getCombinableSyncEither(CA: Combinable, CB: Combinable): Combinable>; /** * @since 2.0.0 */ export declare function getInitializableSyncEither(IA: Initializable, IB: Initializable): Initializable>; /** * @since 2.0.0 */ export declare function getFlatmappableSyncRight(C: Combinable): Flatmappable>; /** * @since 2.0.0 */ export declare const ApplicableSyncEither: Applicable; /** * @since 2.0.0 */ export declare const BimappableSyncEither: Bimappable; /** * @since 2.0.0 */ export declare const FlatmappableSyncEither: Flatmappable; /** * @since 2.0.0 */ export declare const FailableSyncEither: Failable; /** * @since 2.0.0 */ export declare const FoldableSyncEither: Foldable; /** * @since 2.0.0 */ export declare const MappableSyncEither: Mappable; /** * @since 2.0.0 */ export declare const WrappableSyncEither: Wrappable; /** * @since 2.0.0 */ export declare const tap: (fn: (value: A) => void) => (ua: SyncEither) => SyncEither; /** * @since 2.0.0 */ export declare const bind: (name: Exclude, faui: (a: A) => SyncEither) => (ua: SyncEither) => SyncEither; /** * @since 2.0.0 */ export declare const bindTo: (name: N) => (ua: SyncEither) => SyncEither;