/** * @since 2.10.0 */ import { Alt1 } from './Alt' import { Alternative1 } from './Alternative' import { Applicative1 } from './Applicative' import { Apply1 } from './Apply' import { Chain1 } from './Chain' import { Compactable1 } from './Compactable' import { Either } from './Either' import { Filterable1 } from './Filterable' import { FromEither1 } from './FromEither' import { FromIO1 } from './FromIO' import { FromTask1 } from './FromTask' import { Lazy } from './function' import { Functor1 } from './Functor' import { IO } from './IO' import { Monad1 } from './Monad' import { MonadIO1 } from './MonadIO' import { MonadTask1 } from './MonadTask' import * as O from './Option' import { Pointed1 } from './Pointed' import { Predicate } from './Predicate' import { ReadonlyNonEmptyArray } from './ReadonlyNonEmptyArray' import { Refinement } from './Refinement' import { Separated } from './Separated' import * as T from './Task' import { TaskEither } from './TaskEither' import { Zero1 } from './Zero' import Task = T.Task import Option = O.Option /** * @category model * @since 2.10.0 */ export interface TaskOption extends Task> {} /** * @category constructors * @since 2.10.0 */ export declare const some: (a: A) => TaskOption /** * @category lifting * @since 2.10.0 */ export declare const fromPredicate: { (refinement: Refinement): (a: A) => TaskOption (predicate: Predicate): (b: B) => TaskOption (predicate: Predicate): (a: A) => TaskOption } /** * @category conversions * @since 2.10.0 */ export declare const fromOption: (fa: Option) => TaskOption /** * @category conversions * @since 2.10.0 */ export declare const fromEither: (fa: Either) => TaskOption /** * @category conversions * @since 2.10.0 */ export declare const fromIO: (fa: IO) => TaskOption /** * @category conversions * @since 2.10.0 */ export declare const fromTask: (fa: Task) => TaskOption /** * @category conversions * @since 2.11.0 */ export declare const fromTaskEither: (fa: TaskEither) => TaskOption /** * @category pattern matching * @since 2.10.0 */ export declare const match: (onNone: () => B, onSome: (a: A) => B) => (ma: TaskOption) => Task /** * Less strict version of [`match`](#match). * * The `W` suffix (short for **W**idening) means that the handler return types will be merged. * * @category pattern matching * @since 2.10.0 */ export declare const matchW: (onNone: () => B, onSome: (a: A) => C) => (ma: TaskOption) => Task /** * The `E` suffix (short for **E**ffect) means that the handlers return an effect (`Task`). * * @category pattern matching * @since 2.10.0 */ export declare const matchE: (onNone: () => Task, onSome: (a: A) => Task) => (ma: TaskOption) => Task /** * Alias of [`matchE`](#matche). * * @category pattern matching * @since 2.10.0 */ export declare const fold: ( onNone: () => T.Task, onSome: (a: A) => T.Task ) => (ma: TaskOption) => T.Task /** * Less strict version of [`matchE`](#matche). * * The `W` suffix (short for **W**idening) means that the handler return types will be merged. * * @category pattern matching * @since 2.10.0 */ export declare const matchEW: ( onNone: () => Task, onSome: (a: A) => Task ) => (ma: TaskOption) => Task /** * Alias of [`matchEW`](#matchew). * * @category pattern matching * @since 2.10.0 */ export declare const foldW: ( onNone: () => T.Task, onSome: (a: A) => T.Task ) => (ma: TaskOption) => T.Task /** * @category error handling * @since 2.10.0 */ export declare const getOrElse: (onNone: Lazy>) => (fa: TaskOption) => Task /** * Less strict version of [`getOrElse`](#getorelse). * * The `W` suffix (short for **W**idening) means that the handler return type will be merged. * * @category error handling * @since 2.10.0 */ export declare const getOrElseW: (onNone: Lazy>) => (ma: TaskOption) => Task /** * @category conversions * @since 2.10.0 */ export declare const fromNullable: (a: A) => TaskOption> /** * Transforms a `Promise` that may reject to a `Promise` that never rejects and returns an `Option` instead. * * See also [`tryCatchK`](#trycatchk). * * @category interop * @since 2.10.0 */ export declare const tryCatch: (f: Lazy>) => TaskOption /** * Converts a function returning a `Promise` to one returning a `TaskOption`. * * @category interop * @since 2.10.0 */ export declare const tryCatchK: ( f: (...a: A) => Promise ) => (...a: A) => TaskOption /** * @category lifting * @since 2.10.0 */ export declare const fromNullableK: , B>( f: (...a: A) => B | null | undefined ) => (...a: A) => TaskOption> /** * @category sequencing * @since 2.10.0 */ export declare const chainNullableK: ( f: (a: A) => B | null | undefined ) => (ma: TaskOption) => TaskOption> /** * @category lifting * @since 2.10.0 */ export declare const fromOptionK: , B>( f: (...a: A) => Option ) => (...a: A) => TaskOption /** * @category sequencing * @since 2.10.0 */ export declare const chainOptionK: (f: (a: A) => Option) => (ma: TaskOption) => TaskOption /** * `map` can be used to turn functions `(a: A) => B` into functions `(fa: F) => F` whose argument and return types * use the type constructor `F` to represent some computational context. * * @category mapping * @since 2.10.0 */ export declare const map: (f: (a: A) => B) => (fa: TaskOption) => TaskOption /** * @since 2.10.0 */ export declare const ap: (fa: TaskOption) => (fab: TaskOption<(a: A) => B>) => TaskOption /** * @category constructors * @since 2.10.0 */ export declare const of: (a: A) => TaskOption /** * @category sequencing * @since 2.10.0 */ export declare const chain: (f: (a: A) => TaskOption) => (ma: TaskOption) => TaskOption /** * @category sequencing * @since 2.10.0 */ export declare const flatten: (mma: TaskOption>) => TaskOption /** * @category error handling * @since 2.10.0 */ export declare const alt: (second: Lazy>) => (first: TaskOption) => TaskOption /** * Less strict version of [`alt`](#alt). * * The `W` suffix (short for **W**idening) means that the return types will be merged. * * @category error handling * @since 2.10.0 */ export declare const altW: (second: Lazy>) => (first: TaskOption) => TaskOption /** * @since 2.10.0 */ export declare const zero: () => TaskOption /** * @category constructors * @since 2.10.0 */ export declare const none: TaskOption /** * @category filtering * @since 2.10.0 */ export declare const compact: Compactable1['compact'] /** * @category filtering * @since 2.10.0 */ export declare const separate: Compactable1['separate'] /** * @category filtering * @since 2.10.0 */ export declare const filter: { (refinement: Refinement): (fb: TaskOption) => TaskOption (predicate: Predicate): (fb: TaskOption) => TaskOption (predicate: Predicate): (fa: TaskOption) => TaskOption } /** * @category filtering * @since 2.10.0 */ export declare const filterMap: (f: (a: A) => Option) => (fga: TaskOption) => TaskOption /** * @category filtering * @since 2.10.0 */ export declare const partition: { (refinement: Refinement): (fb: TaskOption) => Separated, TaskOption> (predicate: Predicate): (fb: TaskOption) => Separated, TaskOption> (predicate: Predicate): (fa: TaskOption) => Separated, TaskOption> } /** * @category filtering * @since 2.10.0 */ export declare const partitionMap: ( f: (a: A) => Either ) => (fa: TaskOption) => Separated, TaskOption> /** * @category type lambdas * @since 2.10.0 */ export declare const URI = 'TaskOption' /** * @category type lambdas * @since 2.10.0 */ export declare type URI = typeof URI declare module './HKT' { interface URItoKind { readonly [URI]: TaskOption } } /** * @category instances * @since 2.10.0 */ export declare const Functor: Functor1 /** * @category mapping * @since 2.10.0 */ export declare const flap: (a: A) => (fab: TaskOption<(a: A) => B>) => TaskOption /** * @category instances * @since 2.10.0 */ export declare const Pointed: Pointed1 /** * Runs computations in parallel. * * @category instances * @since 2.10.0 */ export declare const ApplyPar: Apply1 /** * Combine two effectful actions, keeping only the result of the first. * * @since 2.10.0 */ export declare const apFirst: (second: TaskOption) => (first: TaskOption) => TaskOption /** * Combine two effectful actions, keeping only the result of the second. * * @since 2.10.0 */ export declare const apSecond: (second: TaskOption) => (first: TaskOption) => TaskOption /** * Runs computations in parallel. * * @category instances * @since 2.10.0 */ export declare const ApplicativePar: Applicative1 /** * Runs computations sequentially. * * @category instances * @since 2.10.0 */ export declare const ApplySeq: Apply1 /** * Runs computations sequentially. * * @category instances * @since 2.10.0 */ export declare const ApplicativeSeq: Applicative1 /** * @category instances * @since 2.10.0 */ export declare const Chain: Chain1 /** * Composes computations in sequence, using the return value of one computation to determine the next computation and * keeping only the result of the first. * * @category sequencing * @since 2.10.0 */ export declare const chainFirst: (f: (a: A) => TaskOption) => (first: TaskOption) => TaskOption /** * @category instances * @since 2.10.0 */ export declare const Alt: Alt1 /** * @category instances * @since 2.11.0 */ export declare const Zero: Zero1 /** * @category do notation * @since 2.11.0 */ export declare const guard: (b: boolean) => TaskOption /** * @category instances * @since 2.10.0 */ export declare const Alternative: Alternative1 /** * @category instances * @since 2.10.0 */ export declare const Monad: Monad1 /** * @category instances * @since 2.10.0 */ export declare const MonadIO: MonadIO1 /** * @category instances * @since 2.10.0 */ export declare const MonadTask: MonadTask1 /** * @category instances * @since 2.10.0 */ export declare const Compactable: Compactable1 /** * @category instances * @since 2.10.0 */ export declare const Filterable: Filterable1 /** * @category instances * @since 2.10.0 */ export declare const FromIO: FromIO1 /** * @category lifting * @since 2.10.0 */ export declare const fromIOK: , B>(f: (...a: A) => IO) => (...a: A) => TaskOption /** * @category sequencing * @since 2.10.0 */ export declare const chainIOK: (f: (a: A) => IO) => (first: TaskOption) => TaskOption /** * @category sequencing * @since 2.10.0 */ export declare const chainFirstIOK: (f: (a: A) => IO) => (first: TaskOption) => TaskOption /** * @category instances * @since 2.11.0 */ export declare const FromEither: FromEither1 /** * @category lifting * @since 2.12.0 */ export declare const fromEitherK: , B>( f: (...a: A) => Either ) => (...a: A) => TaskOption /** * @category sequencing * @since 2.12.0 */ export declare const chainEitherK: (f: (a: A) => Either) => (ma: TaskOption) => TaskOption /** * @category sequencing * @since 2.12.0 */ export declare const chainFirstEitherK: (f: (a: A) => Either) => (ma: TaskOption) => TaskOption /** * @category instances * @since 2.10.0 */ export declare const FromTask: FromTask1 /** * @category lifting * @since 2.10.0 */ export declare const fromTaskK: , B>( f: (...a: A) => T.Task ) => (...a: A) => TaskOption /** * @category sequencing * @since 2.10.0 */ export declare const chainTaskK: (f: (a: A) => T.Task) => (first: TaskOption) => TaskOption /** * @category sequencing * @since 2.10.0 */ export declare const chainFirstTaskK: (f: (a: A) => T.Task) => (first: TaskOption) => TaskOption /** * @category do notation * @since 2.10.0 */ export declare const Do: TaskOption<{}> /** * @category do notation * @since 2.10.0 */ export declare const bindTo: ( name: N ) => (fa: TaskOption) => TaskOption<{ readonly [K in N]: A }> declare const let_: ( name: Exclude, f: (a: A) => B ) => (fa: TaskOption) => TaskOption<{ readonly [K in N | keyof A]: K extends keyof A ? A[K] : B }> export { /** * @category do notation * @since 2.13.0 */ let_ as let } /** * @category do notation * @since 2.10.0 */ export declare const bind: ( name: Exclude, f: (a: A) => TaskOption ) => (ma: TaskOption) => TaskOption<{ readonly [K in N | keyof A]: K extends keyof A ? A[K] : B }> /** * @category do notation * @since 2.10.0 */ export declare const apS: ( name: Exclude, fb: TaskOption ) => (fa: TaskOption) => TaskOption<{ readonly [K in N | keyof A]: K extends keyof A ? A[K] : B }> /** * @since 2.11.0 */ export declare const ApT: TaskOption /** * Equivalent to `ReadonlyNonEmptyArray#traverseWithIndex(ApplicativePar)`. * * @category traversing * @since 2.11.0 */ export declare const traverseReadonlyNonEmptyArrayWithIndex: ( f: (index: number, a: A) => TaskOption ) => (as: ReadonlyNonEmptyArray) => TaskOption> /** * Equivalent to `ReadonlyArray#traverseWithIndex(ApplicativePar)`. * * @category traversing * @since 2.11.0 */ export declare const traverseReadonlyArrayWithIndex: ( f: (index: number, a: A) => TaskOption ) => (as: readonly A[]) => TaskOption /** * Equivalent to `ReadonlyNonEmptyArray#traverseWithIndex(ApplicativeSeq)`. * * @category traversing * @since 2.11.0 */ export declare const traverseReadonlyNonEmptyArrayWithIndexSeq: ( f: (index: number, a: A) => TaskOption ) => (as: ReadonlyNonEmptyArray) => TaskOption> /** * Equivalent to `ReadonlyArray#traverseWithIndex(ApplicativeSeq)`. * * @category traversing * @since 2.11.0 */ export declare const traverseReadonlyArrayWithIndexSeq: ( f: (index: number, a: A) => TaskOption ) => (as: readonly A[]) => TaskOption /** * Equivalent to `ReadonlyArray#traverseWithIndex(Applicative)`. * * @category traversing * @since 2.10.0 */ export declare const traverseArrayWithIndex: ( f: (index: number, a: A) => TaskOption ) => (as: ReadonlyArray) => TaskOption> /** * Equivalent to `ReadonlyArray#traverse(Applicative)`. * * @category traversing * @since 2.10.0 */ export declare const traverseArray: ( f: (a: A) => TaskOption ) => (as: ReadonlyArray) => TaskOption> /** * Equivalent to `ReadonlyArray#sequence(Applicative)`. * * @category traversing * @since 2.10.0 */ export declare const sequenceArray: (as: ReadonlyArray>) => TaskOption> /** * Equivalent to `ReadonlyArray#traverseWithIndex(ApplicativeSeq)`. * * @category traversing * @since 2.10.0 */ export declare const traverseSeqArrayWithIndex: ( f: (index: number, a: A) => TaskOption ) => (as: ReadonlyArray) => TaskOption> /** * Equivalent to `ReadonlyArray#traverse(ApplicativeSeq)`. * * @category traversing * @since 2.10.0 */ export declare const traverseSeqArray: ( f: (a: A) => TaskOption ) => (as: ReadonlyArray) => TaskOption> /** * Equivalent to `ReadonlyArray#sequence(ApplicativeSeq)`. * * @category traversing * @since 2.10.0 */ export declare const sequenceSeqArray: (as: ReadonlyArray>) => TaskOption>