/** * `IOOption` represents a synchronous computation that either yields a value of type `A` or nothing. * * If you want to represent a synchronous computation that never fails, please see `IO`. * If you want to represent a synchronous computation that may fail, please see `IOEither`. * * @since 2.12.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 { Lazy } from './function' import { Functor1 } from './Functor' import { Monad1 } from './Monad' import { MonadIO1 } from './MonadIO' 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 I from './IO' import { IOEither } from './IOEither' import { Zero1 } from './Zero' import IO = I.IO import Option = O.Option /** * @category model * @since 2.12.0 */ export interface IOOption extends IO> {} /** * @category constructors * @since 2.12.0 */ export declare const some: (a: A) => IOOption /** * @category lifting * @since 2.12.0 */ export declare const fromPredicate: { (refinement: Refinement): (a: A) => IOOption (predicate: Predicate): (b: B) => IOOption (predicate: Predicate): (a: A) => IOOption } /** * @category conversions * @since 2.12.0 */ export declare const fromOption: (fa: Option) => IOOption /** * @category conversions * @since 2.12.0 */ export declare const fromEither: (fa: Either) => IOOption /** * @category conversions * @since 2.12.0 */ export declare const fromIO: (fa: IO) => IOOption /** * @category conversions * @since 2.12.0 */ export declare const fromIOEither: (fa: IOEither) => IOOption /** * @category pattern matching * @since 2.12.0 */ export declare const match: (onNone: () => B, onSome: (a: A) => B) => (ma: IOOption) => IO /** * 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.12.0 */ export declare const matchW: (onNone: () => B, onSome: (a: A) => C) => (ma: IOOption) => IO /** * The `E` suffix (short for **E**ffect) means that the handlers return an effect (`IO`). * * @category pattern matching * @since 2.12.0 */ export declare const matchE: (onNone: () => IO, onSome: (a: A) => IO) => (ma: IOOption) => IO /** * Alias of [`matchE`](#matche). * * @category pattern matching * @since 2.12.0 */ export declare const fold: (onNone: () => I.IO, onSome: (a: A) => I.IO) => (ma: IOOption) => I.IO /** * 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.12.0 */ export declare const matchEW: (onNone: () => IO, onSome: (a: A) => IO) => (ma: IOOption) => IO /** * @category error handling * @since 2.12.0 */ export declare const getOrElse: (onNone: Lazy>) => (fa: IOOption) => IO /** * 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.12.0 */ export declare const getOrElseW: (onNone: Lazy>) => (ma: IOOption) => IO /** * @category conversions * @since 2.12.0 */ export declare const toUndefined: (ma: IOOption) => IO /** * @category conversions * @since 2.12.0 */ export declare const toNullable: (ma: IOOption) => IO /** * @category conversions * @since 2.12.0 */ export declare const fromNullable: (a: A) => IOOption> /** * @category lifting * @since 2.12.0 */ export declare const fromNullableK: , B>( f: (...a: A) => B | null | undefined ) => (...a: A) => IOOption> /** * @category sequencing * @since 2.12.0 */ export declare const chainNullableK: ( f: (a: A) => B | null | undefined ) => (ma: IOOption) => IOOption> /** * @category lifting * @since 2.12.0 */ export declare const fromOptionK: , B>( f: (...a: A) => Option ) => (...a: A) => IOOption /** * @category sequencing * @since 2.12.0 */ export declare const chainOptionK: (f: (a: A) => Option) => (ma: IOOption) => IOOption /** * `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.12.0 */ export declare const map: (f: (a: A) => B) => (fa: IOOption) => IOOption /** * @since 2.12.0 */ export declare const ap: (fa: IOOption) => (fab: IOOption<(a: A) => B>) => IOOption /** * @category constructors * @since 2.12.0 */ export declare const of: (a: A) => IOOption /** * @category sequencing * @since 2.12.0 */ export declare const chain: (f: (a: A) => IOOption) => (ma: IOOption) => IOOption /** * @category sequencing * @since 2.12.0 */ export declare const flatten: (mma: IOOption>) => IOOption /** * @category error handling * @since 2.12.0 */ export declare const alt: (second: Lazy>) => (first: IOOption) => IOOption /** * 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.12.0 */ export declare const altW: (second: Lazy>) => (first: IOOption) => IOOption /** * @since 2.12.0 */ export declare const zero: () => IOOption /** * @category constructors * @since 2.12.0 */ export declare const none: IOOption /** * @category filtering * @since 2.12.0 */ export declare const compact: Compactable1['compact'] /** * @category filtering * @since 2.12.0 */ export declare const separate: Compactable1['separate'] /** * @category filtering * @since 2.12.0 */ export declare const filter: { (refinement: Refinement): (fb: IOOption) => IOOption (predicate: Predicate): (fb: IOOption) => IOOption (predicate: Predicate): (fa: IOOption) => IOOption } /** * @category filtering * @since 2.12.0 */ export declare const filterMap: (f: (a: A) => Option) => (fga: IOOption) => IOOption /** * @category filtering * @since 2.12.0 */ export declare const partition: { (refinement: Refinement): (fb: IOOption) => Separated, IOOption> (predicate: Predicate): (fb: IOOption) => Separated, IOOption> (predicate: Predicate): (fa: IOOption) => Separated, IOOption> } /** * @category filtering * @since 2.12.0 */ export declare const partitionMap: ( f: (a: A) => Either ) => (fa: IOOption) => Separated, IOOption> /** * @category type lambdas * @since 2.12.0 */ export declare const URI = 'IOOption' /** * @category type lambdas * @since 2.12.0 */ export declare type URI = typeof URI declare module './HKT' { interface URItoKind { readonly [URI]: IOOption } } /** * @category instances * @since 2.12.0 */ export declare const Functor: Functor1 /** * @category mapping * @since 2.12.0 */ export declare const flap: (a: A) => (fab: IOOption<(a: A) => B>) => IOOption /** * @category instances * @since 2.12.0 */ export declare const Pointed: Pointed1 /** * @category instances * @since 2.12.0 */ export declare const Apply: Apply1 /** * Combine two effectful actions, keeping only the result of the first. * * @since 2.12.0 */ export declare const apFirst: (second: IOOption) => (first: IOOption) => IOOption /** * Combine two effectful actions, keeping only the result of the second. * * @since 2.12.0 */ export declare const apSecond: (second: IOOption) => (first: IOOption) => IOOption /** * @category instances * @since 2.12.0 */ export declare const Applicative: Applicative1 /** * @category instances * @since 2.12.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.12.0 */ export declare const chainFirst: (f: (a: A) => IOOption) => (first: IOOption) => IOOption /** * @category instances * @since 2.12.0 */ export declare const Alt: Alt1 /** * @category instances * @since 2.12.0 */ export declare const Zero: Zero1 /** * @category do notation * @since 2.12.0 */ export declare const guard: (b: boolean) => IOOption /** * @category instances * @since 2.12.0 */ export declare const Alternative: Alternative1 /** * @category instances * @since 2.12.0 */ export declare const Monad: Monad1 /** * @category instances * @since 2.12.0 */ export declare const MonadIO: MonadIO1 /** * @category instances * @since 2.12.0 */ export declare const Compactable: Compactable1 /** * @category instances * @since 2.12.0 */ export declare const Filterable: Filterable1 /** * @category instances * @since 2.12.0 */ export declare const FromIO: FromIO1 /** * @category lifting * @since 2.12.0 */ export declare const fromIOK: , B>(f: (...a: A) => I.IO) => (...a: A) => IOOption /** * @category sequencing * @since 2.12.0 */ export declare const chainIOK: (f: (a: A) => I.IO) => (first: IOOption) => IOOption /** * @category sequencing * @since 2.12.0 */ export declare const chainFirstIOK: (f: (a: A) => I.IO) => (first: IOOption) => IOOption /** * @category instances * @since 2.12.0 */ export declare const FromEither: FromEither1 /** * @category lifting * @since 2.12.0 */ export declare const fromEitherK: , B>( f: (...a: A) => Either ) => (...a: A) => IOOption /** * @category sequencing * @since 2.12.0 */ export declare const chainEitherK: (f: (a: A) => Either) => (ma: IOOption) => IOOption /** * @category sequencing * @since 2.12.0 */ export declare const chainFirstEitherK: (f: (a: A) => Either) => (ma: IOOption) => IOOption /** * @category do notation * @since 2.12.0 */ export declare const Do: IOOption<{}> /** * @category do notation * @since 2.12.0 */ export declare const bindTo: (name: N) => (fa: IOOption) => IOOption<{ readonly [K in N]: A }> declare const let_: ( name: Exclude, f: (a: A) => B ) => (fa: IOOption) => IOOption<{ 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.12.0 */ export declare const bind: ( name: Exclude, f: (a: A) => IOOption ) => (ma: IOOption) => IOOption<{ readonly [K in N | keyof A]: K extends keyof A ? A[K] : B }> /** * @category do notation * @since 2.12.0 */ export declare const apS: ( name: Exclude, fb: IOOption ) => (fa: IOOption) => IOOption<{ readonly [K in N | keyof A]: K extends keyof A ? A[K] : B }> /** * @since 2.12.0 */ export declare const ApT: IOOption /** * Equivalent to `ReadonlyNonEmptyArray#traverseWithIndex(Applicative)`. * * @category traversing * @since 2.12.0 */ export declare const traverseReadonlyNonEmptyArrayWithIndex: ( f: (index: number, a: A) => IOOption ) => (as: ReadonlyNonEmptyArray) => IOOption> /** * Equivalent to `ReadonlyArray#traverseWithIndex(Applicative)`. * * @category traversing * @since 2.12.0 */ export declare const traverseReadonlyArrayWithIndex: ( f: (index: number, a: A) => IOOption ) => (as: readonly A[]) => IOOption