Op
Op:
object
Defined in: Core/Op.ts:63
Type Declaration
Section titled “Type Declaration”all: <
E,A>(invocations) =>Deferred<readonlyOutcome<E,A>[]>
Type Parameters
Section titled “Type Parameters”E
A
Parameters
Section titled “Parameters”invocations
Section titled “invocations”readonly Deferred<Outcome<E, A>>[]
Returns
Section titled “Returns”Deferred<readonly Outcome<E, A>[]>
chain: <
E,A,B>(f) => (outcome) =>Outcome<E,B>
Type Parameters
Section titled “Type Parameters”E
A
B
Parameters
Section titled “Parameters”(a) => Outcome<E, B>
Returns
Section titled “Returns”(outcome) => Outcome<E, B>
create
Section titled “create”create: <
E,A,I>(factory,onError) =>Op<I,E,A>
Type Parameters
Section titled “Type Parameters”E
A
I = void
Parameters
Section titled “Parameters”factory
Section titled “factory”(signal) => (input) => Promise<A>
onError
Section titled “onError”(e) => E
Returns
Section titled “Returns”Op<I, E, A>
fold: <
E,A,B>(onErr,onNil,onOk) => (outcome) =>B
Type Parameters
Section titled “Type Parameters”E
A
B
Parameters
Section titled “Parameters”(e) => B
() => B
(a) => B
Returns
Section titled “Returns”(outcome) => B
getOrElse
Section titled “getOrElse”getOrElse: <
E,A,B>(defaultValue) => (outcome) =>A|B
Type Parameters
Section titled “Type Parameters”E
A
B
Parameters
Section titled “Parameters”defaultValue
Section titled “defaultValue”() => B
Returns
Section titled “Returns”(outcome) => A | B
interpret
Section titled “interpret”interpret: <
I,E,A,O>(op,options) =>InterpretResult<I,E,A,O> =interpretFn
Type Parameters
Section titled “Type Parameters”I
E
A
O extends AllInterpretOptions<I, E>
Parameters
Section titled “Parameters”Op<I, E, A>
options
Section titled “options”O
Returns
Section titled “Returns”InterpretResult<I, E, A, O>
is:
object
is.err
Section titled “is.err”err: <
E,A>(state) =>state is Err<E>=isErr
Type guard that checks if an Op state or outcome is Err.
Type Parameters
Section titled “Type Parameters”E
A
Parameters
Section titled “Parameters”State<E, A>
Returns
Section titled “Returns”state is Err<E>
Example
Section titled “Example”is.idle
Section titled “is.idle”idle: <
E,A>(state) =>state is Idle=isIdle
Type guard that checks if an Op state is Idle.
Type Parameters
Section titled “Type Parameters”E
A
Parameters
Section titled “Parameters”State<E, A>
Returns
Section titled “Returns”state is Idle
Example
Section titled “Example”is.nil
Section titled “is.nil”nil: <
E,A>(state) =>state is Nil=isNil
Type guard that checks if an Op state or outcome is Nil.
Type Parameters
Section titled “Type Parameters”E
A
Parameters
Section titled “Parameters”State<E, A>
Returns
Section titled “Returns”state is Nil
Example
Section titled “Example”ok: <
E,A>(state) =>state is Ok<A>=isOk
Type guard that checks if an Op state or outcome is Ok.
Type Parameters
Section titled “Type Parameters”E
A
Parameters
Section titled “Parameters”State<E, A>
Returns
Section titled “Returns”state is Ok<A>
Example
Section titled “Example”is.pending
Section titled “is.pending”pending: <
E,A>(state) =>state is Pending=isPending
Type guard that checks if an Op state is Pending (actively executing).
Type Parameters
Section titled “Type Parameters”E
A
Parameters
Section titled “Parameters”State<E, A>
Returns
Section titled “Returns”state is Pending
Example
Section titled “Example”is.queued
Section titled “is.queued”queued: <
E,A>(state) =>state is Queued=isQueued
Type guard that checks if an Op state is Queued (waiting in a concurrency queue).
Type Parameters
Section titled “Type Parameters”E
A
Parameters
Section titled “Parameters”State<E, A>
Returns
Section titled “Returns”state is Queued
Example
Section titled “Example”is.retrying
Section titled “is.retrying”retrying: <
E,A>(state) =>state is Retrying<E>=isRetrying
Type guard that checks if an Op state is Retrying after a failure.
Type Parameters
Section titled “Type Parameters”E
A
Parameters
Section titled “Parameters”State<E, A>
Returns
Section titled “Returns”state is Retrying<E>
Example
Section titled “Example”lift: <
I,A>(f) =>Op<I,unknown,A>
Type Parameters
Section titled “Type Parameters”I
A
Parameters
Section titled “Parameters”(input, signal) => Promise<A>
Returns
Section titled “Returns”Op<I, unknown, A>
make:
object
make.err
Section titled “make.err”err: <
E>(error) =>Err<E> =makeErr
Creates an Err outcome with the given error.
Type Parameters
Section titled “Type Parameters”E
Parameters
Section titled “Parameters”E
Returns
Section titled “Returns”Err<E>
Example
Section titled “Example”make.nil
Section titled “make.nil”nil: (
reason) =>Nil=makeNil
Creates a Nil outcome with the given cancellation/drop reason.
Parameters
Section titled “Parameters”reason
Section titled “reason”Returns
Section titled “Returns”Example
Section titled “Example”make.ok
Section titled “make.ok”ok: <
A>(value) =>Ok<A> =makeOk
Creates an Ok outcome with the given value.
Type Parameters
Section titled “Type Parameters”A
Parameters
Section titled “Parameters”A
Returns
Section titled “Returns”Ok<A>
Example
Section titled “Example”map: <
E,A,B>(f) => (outcome) =>Outcome<E,B>
Type Parameters
Section titled “Type Parameters”E
A
B
Parameters
Section titled “Parameters”(a) => B
Returns
Section titled “Returns”(outcome) => Outcome<E, B>
mapError
Section titled “mapError”mapError: <
E,F,A>(f) => (outcome) =>Outcome<F,A>
Type Parameters
Section titled “Type Parameters”E
F
A
Parameters
Section titled “Parameters”(e) => F
Returns
Section titled “Returns”(outcome) => Outcome<F, A>
match: <
E,A,B>(cases) => (outcome) =>B
Type Parameters
Section titled “Type Parameters”E
A
B
Parameters
Section titled “Parameters”(e) => B
() => B
(a) => B
Returns
Section titled “Returns”(outcome) => B
Type Parameters
Section titled “Type Parameters”E
A
Parameters
Section titled “Parameters”invocations
Section titled “invocations”readonly Deferred<Outcome<E, A>>[]
Returns
Section titled “Returns”recover
Section titled “recover”recover: <
E,A,B>(f) => (outcome) =>Outcome<E,A|B>
Type Parameters
Section titled “Type Parameters”E
A
B
Parameters
Section titled “Parameters”(e) => Outcome<E, B>
Returns
Section titled “Returns”(outcome) => Outcome<E, A | B>
tap: <
E,A>(f) => (outcome) =>Outcome<E,A>
Type Parameters
Section titled “Type Parameters”E
A
Parameters
Section titled “Parameters”(a) => void
Returns
Section titled “Returns”(outcome) => Outcome<E, A>
to:
object
to.Maybe
Section titled “to.Maybe”Maybe: <
E,A>(outcome) =>Maybe<A>
Type Parameters
Section titled “Type Parameters”E
A
Parameters
Section titled “Parameters”outcome
Section titled “outcome”Outcome<E, A>
Returns
Section titled “Returns”Maybe<A>
to.Result
Section titled “to.Result”Result: <
E,A>(onNil) => (outcome) =>Result<E,A>
Type Parameters
Section titled “Type Parameters”E
A
Parameters
Section titled “Parameters”() => E
Returns
Section titled “Returns”(outcome) => Result<E, A>
wire: <
I,E,A,S>(source,f) => () =>void
Type Parameters
Section titled “Type Parameters”I
E
A
S extends State<E, A>
Parameters
Section titled “Parameters”source
Section titled “source”Manager<I, E, A, S>
(a) => void
Returns
Section titled “Returns”() => void