Overview

IOEither<L, A> represents a synchronous computation that either yields a value of type A or fails yielding an error of type L. If you want to represent a synchronous computation that never fails, please see IO.


Table of contents


URI (type alias)

Signature

export type URI = typeof URI

IOEither (class)

Signature

export class IOEither<L, A> {
  constructor(readonly value: IO<Either<L, A>>) { ... }
  ...
}

Added in v1.6.0

run (method)

Runs the inner io

Signature

run(): Either<L, A> { ... }

map (method)

Signature

map<B>(f: (a: A) => B): IOEither<L, B> { ... }

ap (method)

Signature

ap<B>(fab: IOEither<L, (a: A) => B>): IOEither<L, B> { ... }

ap_ (method)

Flipped version of ap

Signature

ap_<B, C>(this: IOEither<L, (b: B) => C>, fb: IOEither<L, B>): IOEither<L, C> { ... }

applyFirst (method)

Combine two effectful actions, keeping only the result of the first

Signature

applyFirst<B>(fb: IOEither<L, B>): IOEither<L, A> { ... }

applySecond (method)

Combine two effectful actions, keeping only the result of the second

Signature

applySecond<B>(fb: IOEither<L, B>): IOEither<L, B> { ... }

chain (method)

Signature

chain<B>(f: (a: A) => IOEither<L, B>): IOEither<L, B> { ... }

fold (method)

Signature

fold<R>(left: (l: L) => R, right: (a: A) => R): IO<R> { ... }

mapLeft (method)

Signature

mapLeft<M>(f: (l: L) => M): IOEither<M, A> { ... }

orElse (method)

Signature

orElse<M>(f: (l: L) => IOEither<M, A>): IOEither<M, A> { ... }

alt (method)

Signature

alt(fy: IOEither<L, A>): IOEither<L, A> { ... }

bimap (method)

Signature

bimap<V, B>(f: (l: L) => V, g: (a: A) => B): IOEither<V, B> { ... }

URI (constant)

Signature

export const URI = ...

ioEither (constant)

Signature

export const ioEither: Monad2<URI> & Bifunctor2<URI> & Alt2<URI> = ...

Added in v1.6.0

fromEither (function)

Signature

export const fromEither = <L, A>(fa: Either<L, A>): IOEither<L, A> => ...

Added in v1.6.0

fromLeft (function)

Signature

export const fromLeft = <L, A>(l: L): IOEither<L, A> => ...

Added in v1.6.0

left (function)

Signature

export const left = <L, A>(fa: IO<L>): IOEither<L, A> => ...

Added in v1.6.0

right (function)

Signature

export const right = <L, A>(fa: IO<A>): IOEither<L, A> => ...

Added in v1.6.0

tryCatch (function)

Use tryCatch2v instead

Signature

export const tryCatch = <A>(f: Lazy<A>, onerror: (reason: unknown) => Error = toError): IOEither<Error, A> => ...

Added in v1.6.0

tryCatch2v (function)

Signature

export const tryCatch2v = <L, A>(f: Lazy<A>, onerror: (reason: unknown) => L): IOEither<L, A> => ...

Added in v1.11.0