TaskOption
Instances
- Alt
- Alternative
- ApplicativePar
- ApplicativeSeq
- ApplyPar
- ApplySeq
- Chain
- ChainRec
- Compactable
- Filterable
- FromEither
- FromIO
- FromTask
- Functor
- Monad
- MonadIO
- MonadTask
- MonadThrow
- Pointed
- Zero
Combinators
Constructors
Conversions
Do notation
Error handling
Filtering
Instance methods
Interop
Legacy
Lifting
Mapping
Model
Pattern matching
Sequencing
Traversing
- sequenceArray
- sequenceSeqArray
- traverseArray
- traverseArrayWithIndex
- traverseReadonlyArrayWithIndex
- traverseReadonlyArrayWithIndexSeq
- traverseReadonlyNonEmptyArrayWithIndex
- traverseReadonlyNonEmptyArrayWithIndexSeq
- traverseSeqArray
- traverseSeqArrayWithIndex
Type lambdas
Utilities
Instances
Alt
Signature
export declare const Alt: Alt1<URI>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
Alternative
Signature
export declare const Alternative: Alternative1<URI>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
ApplicativePar
Runs computations in parallel.
Signature
export declare const ApplicativePar: Applicative1<URI>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
ApplicativeSeq
Runs computations sequentially.
Signature
export declare const ApplicativeSeq: Applicative1<URI>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
ApplyPar
Runs computations in parallel.
Signature
export declare const ApplyPar: Apply1<URI>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
ApplySeq
Runs computations sequentially.
Signature
export declare const ApplySeq: Apply1<URI>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
Chain
Signature
export declare const Chain: chainable.Chain1<URI>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
ChainRec
ChainRec for TaskOption
Signature
export declare const ChainRec: ChainRec1<URI>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2022-present Jacob Alford
Compactable
Signature
export declare const Compactable: Compactable1<URI>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
Filterable
Signature
export declare const Filterable: Filterable1<URI>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
FromEither
Signature
export declare const FromEither: FromEither1<URI>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
FromIO
Signature
export declare const FromIO: FromIO1<URI>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
FromTask
Signature
export declare const FromTask: FromTask1<URI>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
Functor
Signature
export declare const Functor: Functor1<URI>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
Monad
Signature
export declare const Monad: Monad1<URI>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
MonadIO
Signature
export declare const MonadIO: MonadIO1<URI>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
MonadTask
Signature
export declare const MonadTask: MonadTask1<URI>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
MonadThrow
Signature
export declare const MonadThrow: MonadThrow1<URI>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
Pointed
Signature
export declare const Pointed: Pointed1<URI>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
Zero
Signature
export declare const Zero: Zero1<URI>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
Combinators
tap
Composes computations in sequence, using the return value of one computation to determine the next computation and keeping only the result of the first.
Signature
export declare const tap: {
<A, _>(self: TaskOption<A>, f: (a: A) => TaskOption<_>): TaskOption<A>
<A, _>(f: (a: A) => TaskOption<_>): (self: TaskOption<A>) => TaskOption<A>
}
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
tapEither
Composes computations in sequence, using the return value of one computation to determine the next computation and keeping only the result of the first.
Signature
export declare const tapEither: {
<A, E, _>(f: (a: A) => Either<E, _>): (self: TaskOption<A>) => TaskOption<A>
<A, E, _>(self: TaskOption<A>, f: (a: A) => Either<E, _>): TaskOption<A>
}
Details
- Added in 0.1.0
Example
import { pipe } from '@fp-tx/core/function'
import * as TO from '@fp-tx/core/TaskOption'
import * as O from '@fp-tx/core/Option'
import * as E from '@fp-tx/core/Either'
const compute = (value: number) =>
pipe(
TO.of(value),
TO.tapEither(value => (value > 0 ? E.right('ok') : E.left('error'))),
)
async function test() {
assert.deepStrictEqual(await compute(1)(), O.of(1))
assert.deepStrictEqual(await compute(-1)(), O.none)
}
test()
License
- MIT – Copyright (c) 2017-present Giulio Canti
tapIO
Composes computations in sequence, using the return value of one computation to determine the next computation and keeping only the result of the first.
Signature
export declare const tapIO: {
<A, _>(f: (a: A) => IO<_>): (self: TaskOption<A>) => TaskOption<A>
<A, _>(self: TaskOption<A>, f: (a: A) => IO<_>): TaskOption<A>
}
Details
- Added in 0.1.0
Example
import { pipe } from '@fp-tx/core/function'
import * as TO from '@fp-tx/core/TaskOption'
import * as O from '@fp-tx/core/Option'
import * as Console from '@fp-tx/core/Console'
// Will produce `Hello, fp-ts` to the stdout
const effectA = TO.tapIO(TO.of(1), value => Console.log(`Hello, ${value}`))
// No output to the stdout
const effectB = pipe(
TO.none as TO.TaskOption<string>,
TO.tapIO(value => Console.log(`Hello, ${value}`)),
)
async function test() {
assert.deepStrictEqual(await effectA(), O.of(1))
assert.deepStrictEqual(await effectB(), O.none)
}
test()
License
- MIT – Copyright (c) 2017-present Giulio Canti
tapTask
Composes computations in sequence, using the return value of one computation to determine the next computation and keeping only the result of the first.
Signature
export declare const tapTask: {
<A, _>(f: (a: A) => Task<_>): (self: TaskOption<A>) => TaskOption<A>
<A, _>(self: TaskOption<A>, f: (a: A) => Task<_>): TaskOption<A>
}
Details
- Added in 0.1.0
Example
import * as TO from '@fp-tx/core/TaskOption'
import * as O from '@fp-tx/core/Option'
import * as T from '@fp-tx/core/Task'
const effect = TO.tapIO(TO.of(1), value => T.of(value + 1))
async function test() {
assert.deepStrictEqual(await effect(), O.of(1))
}
test()
License
- MIT – Copyright (c) 2017-present Giulio Canti
Constructors
none
Signature
export declare const none: TaskOption<never>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
of
Signature
export declare const of: <A>(a: A) => TaskOption<A>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
some
Signature
export declare const some: <A>(a: A) => TaskOption<A>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
Conversions
fromEither
Signature
export declare const fromEither: <A>(fa: Either<unknown, A>) => TaskOption<A>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
fromIO
Signature
export declare const fromIO: <A>(fa: IO<A>) => TaskOption<A>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
fromNullable
Signature
export declare const fromNullable: <A>(a: A) => TaskOption<NonNullable<A>>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
fromOption
Signature
export declare const fromOption: <A>(fa: Option<A>) => TaskOption<A>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
fromTask
Signature
export declare const fromTask: <A>(fa: Task<A>) => TaskOption<A>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
fromTaskEither
Signature
export declare const fromTaskEither: <A>(fa: TaskEither<unknown, A>) => TaskOption<A>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
Do notation
Do
Signature
export declare const Do: TaskOption<{}>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
apS
Signature
export declare const apS: <N extends string, A, B>(
name: Exclude<N, keyof A>,
fb: TaskOption<B>,
) => (fa: TaskOption<A>) => TaskOption<{ readonly [K in N | keyof A]: K extends keyof A ? A[K] : B }>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
bind
Signature
export declare const bind: <N extends string, A, B>(
name: Exclude<N, keyof A>,
f: (a: A) => TaskOption<B>,
) => (ma: TaskOption<A>) => TaskOption<{ readonly [K in N | keyof A]: K extends keyof A ? A[K] : B }>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
bindTo
Signature
export declare const bindTo: <N extends string>(
name: N,
) => <A>(fa: TaskOption<A>) => TaskOption<{ readonly [K in N]: A }>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
guard
Signature
export declare const guard: (b: boolean) => TaskOption<void>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
Error handling
alt
Signature
export declare const alt: <A>(second: LazyArg<TaskOption<A>>) => (first: TaskOption<A>) => TaskOption<A>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
altW
Less strict version of alt
.
The W
suffix (short for Widening) means that the return types will be merged.
Signature
export declare const altW: <B>(second: LazyArg<TaskOption<B>>) => <A>(first: TaskOption<A>) => TaskOption<A | B>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
getOrElse
Signature
export declare const getOrElse: <A>(onNone: LazyArg<Task<A>>) => (fa: TaskOption<A>) => Task<A>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
getOrElseW
Less strict version of getOrElse
.
The W
suffix (short for Widening) means that the handler return type will be merged.
Signature
export declare const getOrElseW: <B>(onNone: LazyArg<Task<B>>) => <A>(ma: TaskOption<A>) => Task<A | B>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
Filtering
compact
Signature
export declare const compact: Compactable1<URI>['compact']
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
filter
Signature
export declare const filter: {
<A, B extends A>(refinement: Refinement<A, B>): (fb: TaskOption<A>) => TaskOption<B>
<A>(predicate: Predicate<A>): <B extends A>(fb: TaskOption<B>) => TaskOption<B>
<A>(predicate: Predicate<A>): (fa: TaskOption<A>) => TaskOption<A>
}
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
filterMap
Signature
export declare const filterMap: <A, B>(f: (a: A) => Option<B>) => (fga: TaskOption<A>) => TaskOption<B>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
partition
Signature
export declare const partition: {
<A, B extends A>(refinement: Refinement<A, B>): (fb: TaskOption<A>) => Separated<TaskOption<A>, TaskOption<B>>
<A>(predicate: Predicate<A>): <B extends A>(fb: TaskOption<B>) => Separated<TaskOption<B>, TaskOption<B>>
<A>(predicate: Predicate<A>): (fa: TaskOption<A>) => Separated<TaskOption<A>, TaskOption<A>>
}
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
partitionMap
Signature
export declare const partitionMap: <A, B, C>(
f: (a: A) => Either<B, C>,
) => (fa: TaskOption<A>) => Separated<TaskOption<B>, TaskOption<C>>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
separate
Signature
export declare const separate: Compactable1<URI>['separate']
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
Instance methods
chainRec
Signature
export declare const chainRec: ChainRec1<URI>['chainRec']
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2022-present Jacob Alford
Interop
tryCatch
Transforms a Promise
that may reject to a Promise
that never rejects and returns an Option
instead.
See also tryCatchK
.
Signature
export declare const tryCatch: <A>(f: LazyArg<Promise<A>>) => TaskOption<A>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
tryCatchK
Converts a function returning a Promise
to one returning a TaskOption
.
Signature
export declare const tryCatchK: <A extends readonly unknown[], B>(
f: (...a: A) => Promise<B>,
) => (...a: A) => TaskOption<B>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
Legacy
chain
Alias of flatMap
.
Signature
export declare const chain: <A, B>(f: (a: A) => TaskOption<B>) => (ma: TaskOption<A>) => TaskOption<B>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
chainFirst
Alias of tap
.
Signature
export declare const chainFirst: <A, B>(f: (a: A) => TaskOption<B>) => (first: TaskOption<A>) => TaskOption<A>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
chainFirstEitherK
Alias of tapEither
.
Signature
export declare const chainFirstEitherK: <E, A, B>(f: (a: A) => Either<E, B>) => (ma: TaskOption<A>) => TaskOption<A>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
chainFirstIOK
Alias of tapIO
.
Signature
export declare const chainFirstIOK: <A, B>(f: (a: A) => IO<B>) => (first: TaskOption<A>) => TaskOption<A>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
chainFirstTaskK
Alias of tapTask
.
Signature
export declare const chainFirstTaskK: <A, B>(f: (a: A) => T.Task<B>) => (first: TaskOption<A>) => TaskOption<A>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
chainIOK
Alias of flatMapIO
.
Signature
export declare const chainIOK: <A, B>(f: (a: A) => IO<B>) => (first: TaskOption<A>) => TaskOption<B>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
chainTaskK
Alias of flatMapTask
.
Signature
export declare const chainTaskK: <A, B>(f: (a: A) => T.Task<B>) => (first: TaskOption<A>) => TaskOption<B>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
Lifting
fromEitherK
Signature
export declare const fromEitherK: <E, A extends ReadonlyArray<unknown>, B>(
f: (...a: A) => Either<E, B>,
) => (...a: A) => TaskOption<B>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
fromIOK
Signature
export declare const fromIOK: <A extends ReadonlyArray<unknown>, B>(f: (...a: A) => IO<B>) => (...a: A) => TaskOption<B>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
fromNullableK
Signature
export declare const fromNullableK: <A extends ReadonlyArray<unknown>, B>(
f: (...a: A) => B | null | undefined,
) => (...a: A) => TaskOption<NonNullable<B>>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
fromOptionK
Signature
export declare const fromOptionK: <A extends ReadonlyArray<unknown>, B>(
f: (...a: A) => Option<B>,
) => (...a: A) => TaskOption<B>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
fromPredicate
Signature
export declare const fromPredicate: {
<A, B extends A>(refinement: Refinement<A, B>): (a: A) => TaskOption<B>
<A>(predicate: Predicate<A>): <B extends A>(b: B) => TaskOption<B>
<A>(predicate: Predicate<A>): (a: A) => TaskOption<A>
}
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
fromTaskK
Signature
export declare const fromTaskK: <A extends ReadonlyArray<unknown>, B>(
f: (...a: A) => T.Task<B>,
) => (...a: A) => TaskOption<B>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
Mapping
as
Maps the Some
value of this TaskOption
to the specified constant value.
Signature
export declare const as: {
<A>(a: A): <_>(self: TaskOption<_>) => TaskOption<A>
<_, A>(self: TaskOption<_>, a: A): TaskOption<A>
}
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
asUnit
Maps the Some
value of this TaskOption
to the void constant value.
Signature
export declare const asUnit: <_>(self: TaskOption<_>) => TaskOption<void>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
flap
Signature
export declare const flap: <A>(a: A) => <B>(fab: TaskOption<(a: A) => B>) => TaskOption<B>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
map
map
can be used to turn functions (a: A) => B
into functions (fa: F<A>) => F<B>
whose argument and return types use the type constructor F
to represent some computational context.
Signature
export declare const map: <A, B>(f: (a: A) => B) => (fa: TaskOption<A>) => TaskOption<B>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
Model
TaskOption
Signature
export interface TaskOption<A> extends Task<Option<A>> {}
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
Pattern matching
fold
Alias of matchE
.
Signature
export declare const fold: <B, A>(
onNone: () => T.Task<B>,
onSome: (a: A) => T.Task<B>,
) => (ma: TaskOption<A>) => T.Task<B>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
foldW
Alias of matchEW
.
Signature
export declare const foldW: <B, C, A>(
onNone: () => T.Task<B>,
onSome: (a: A) => T.Task<C>,
) => (ma: TaskOption<A>) => T.Task<B | C>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
match
Signature
export declare const match: <B, A>(onNone: () => B, onSome: (a: A) => B) => (ma: TaskOption<A>) => Task<B>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
matchE
The E
suffix (short for Effect) means that the handlers return an effect (Task
).
Signature
export declare const matchE: <B, A>(onNone: () => Task<B>, onSome: (a: A) => Task<B>) => (ma: TaskOption<A>) => Task<B>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
matchEW
Less strict version of matchE
.
The W
suffix (short for Widening) means that the handler return types will be merged.
Signature
export declare const matchEW: <B, C, A>(
onNone: () => Task<B>,
onSome: (a: A) => Task<C>,
) => (ma: TaskOption<A>) => Task<B | C>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
matchW
Less strict version of match
.
The W
suffix (short for Widening) means that the handler return types will be merged.
Signature
export declare const matchW: <B, A, C>(onNone: () => B, onSome: (a: A) => C) => (ma: TaskOption<A>) => Task<B | C>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
Sequencing
chainEitherK
Signature
export declare const chainEitherK: <E, A, B>(f: (a: A) => Either<E, B>) => (ma: TaskOption<A>) => TaskOption<B>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
chainNullableK
Signature
export declare const chainNullableK: <A, B>(
f: (a: A) => B | null | undefined,
) => (ma: TaskOption<A>) => TaskOption<NonNullable<B>>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
chainOptionK
Signature
export declare const chainOptionK: <A, B>(f: (a: A) => Option<B>) => (ma: TaskOption<A>) => TaskOption<B>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
flatMap
Signature
export declare const flatMap: {
<A, B>(f: (a: A) => TaskOption<B>): (ma: TaskOption<A>) => TaskOption<B>
<A, B>(ma: TaskOption<A>, f: (a: A) => TaskOption<B>): TaskOption<B>
}
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
flatMapIO
Signature
export declare const flatMapIO: {
<A, B>(f: (a: A) => IO<B>): (self: TaskOption<A>) => TaskOption<B>
<A, B>(self: TaskOption<A>, f: (a: A) => IO<B>): TaskOption<B>
}
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
flatMapTask
Signature
export declare const flatMapTask: {
<A, B>(f: (a: A) => Task<B>): (self: TaskOption<A>) => TaskOption<B>
<A, B>(self: TaskOption<A>, f: (a: A) => Task<B>): TaskOption<B>
}
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
flatten
Signature
export declare const flatten: <A>(mma: TaskOption<TaskOption<A>>) => TaskOption<A>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
Traversing
sequenceArray
Equivalent to ReadonlyArray#sequence(Applicative)
.
Signature
export declare const sequenceArray: <A>(as: ReadonlyArray<TaskOption<A>>) => TaskOption<ReadonlyArray<A>>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
sequenceSeqArray
Equivalent to ReadonlyArray#sequence(ApplicativeSeq)
.
Signature
export declare const sequenceSeqArray: <A>(as: ReadonlyArray<TaskOption<A>>) => TaskOption<ReadonlyArray<A>>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
traverseArray
Equivalent to ReadonlyArray#traverse(Applicative)
.
Signature
export declare const traverseArray: <A, B>(
f: (a: A) => TaskOption<B>,
) => (as: ReadonlyArray<A>) => TaskOption<ReadonlyArray<B>>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
traverseArrayWithIndex
Equivalent to ReadonlyArray#traverseWithIndex(Applicative)
.
Signature
export declare const traverseArrayWithIndex: <A, B>(
f: (index: number, a: A) => TaskOption<B>,
) => (as: ReadonlyArray<A>) => TaskOption<ReadonlyArray<B>>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
traverseReadonlyArrayWithIndex
Equivalent to ReadonlyArray#traverseWithIndex(ApplicativePar)
.
Signature
export declare const traverseReadonlyArrayWithIndex: <A, B>(
f: (index: number, a: A) => TaskOption<B>,
) => (as: readonly A[]) => TaskOption<readonly B[]>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
traverseReadonlyArrayWithIndexSeq
Equivalent to ReadonlyArray#traverseWithIndex(ApplicativeSeq)
.
Signature
export declare const traverseReadonlyArrayWithIndexSeq: <A, B>(
f: (index: number, a: A) => TaskOption<B>,
) => (as: readonly A[]) => TaskOption<readonly B[]>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
traverseReadonlyNonEmptyArrayWithIndex
Equivalent to ReadonlyNonEmptyArray#traverseWithIndex(ApplicativePar)
.
Signature
export declare const traverseReadonlyNonEmptyArrayWithIndex: <A, B>(
f: (index: number, a: A) => TaskOption<B>,
) => (as: ReadonlyNonEmptyArray<A>) => TaskOption<ReadonlyNonEmptyArray<B>>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
traverseReadonlyNonEmptyArrayWithIndexSeq
Equivalent to ReadonlyNonEmptyArray#traverseWithIndex(ApplicativeSeq)
.
Signature
export declare const traverseReadonlyNonEmptyArrayWithIndexSeq: <A, B>(
f: (index: number, a: A) => TaskOption<B>,
) => (as: ReadonlyNonEmptyArray<A>) => TaskOption<ReadonlyNonEmptyArray<B>>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
traverseSeqArray
Equivalent to ReadonlyArray#traverse(ApplicativeSeq)
.
Signature
export declare const traverseSeqArray: <A, B>(
f: (a: A) => TaskOption<B>,
) => (as: ReadonlyArray<A>) => TaskOption<ReadonlyArray<B>>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
traverseSeqArrayWithIndex
Equivalent to ReadonlyArray#traverseWithIndex(ApplicativeSeq)
.
Signature
export declare const traverseSeqArrayWithIndex: <A, B>(
f: (index: number, a: A) => TaskOption<B>,
) => (as: ReadonlyArray<A>) => TaskOption<ReadonlyArray<B>>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
Type lambdas
URI
Signature
export type URI = typeof URI
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
URI
Signature
export declare const URI = 'TaskOption'
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
Utilities
ApT
Signature
export declare const ApT: TaskOption<readonly []>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
ap
Signature
export declare const ap: <A>(fa: TaskOption<A>) => <B>(fab: TaskOption<(a: A) => B>) => TaskOption<B>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
apFirst
Combine two effectful actions, keeping only the result of the first.
Signature
export declare const apFirst: <B>(second: TaskOption<B>) => <A>(first: TaskOption<A>) => TaskOption<A>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
apSecond
Combine two effectful actions, keeping only the result of the second.
Signature
export declare const apSecond: <B>(second: TaskOption<B>) => <A>(first: TaskOption<A>) => TaskOption<B>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
do
Signature
export declare const do_: <MA extends TaskOptionIterable<any>, A>(
yieldFunction: (unwrap: <A>(ma: TaskOption<A>) => TaskOptionIterable<A>) => Generator<MA, A>,
) => TaskOption<A>
let
Signature
export declare const let_: <N extends string, A, B>(
name: Exclude<N, keyof A>,
f: (a: A) => B,
) => (fa: TaskOption<A>) => TaskOption<{ readonly [K in N | keyof A]: K extends keyof A ? A[K] : B }>
throwError
Signature
export declare const throwError: MonadThrow1<URI>['throwError']
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
zero
Signature
export declare const zero: <A>() => TaskOption<A>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti