Overview

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


Table of contents


IOEither (interface)

Signature

export interface IOEither<E, A> extends IO<Either<E, A>> {}

Added in v2.0.0

URI (type alias)

Signature

export type URI = typeof URI

Added in v2.0.0

URI (constant)

Signature

export const URI: "IOEither" = ...

Added in v2.0.0

ioEither (constant)

Signature

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

Added in v2.0.0

left (constant)

Signature

export const left: <E = ...

Added in v2.0.0

leftIO (constant)

Signature

export const leftIO: <E = ...

Added in v2.0.0

right (constant)

Signature

export const right: <E = ...

Added in v2.0.0

rightIO (constant)

Signature

export const rightIO: <E = ...

Added in v2.0.0

swap (constant)

Signature

export const swap: <E, A>(ma: IOEither<E, A>) => IOEither<A, E> = ...

Added in v2.0.0

bracket (function)

Make sure that a resource is cleaned up in the event of an exception (). The release action is called regardless of whether the body action throws () or returns.

(*) i.e. returns a Left

Signature

export function bracket<E, A, B>(
  acquire: IOEither<E, A>,
  use: (a: A) => IOEither<E, B>,
  release: (a: A, e: Either<E, B>) => IOEither<E, void>
): IOEither<E, B> { ... }

Added in v2.0.0

fold (function)

Signature

export function fold<E, A, B>(onLeft: (e: E) => IO<B>, onRight: (a: A) => IO<B>): (ma: IOEither<E, A>) => IO<B> { ... }

Added in v2.0.0

getApplyMonoid (function)

Signature

export function getApplyMonoid<E, A>(M: Monoid<A>): Monoid<IOEither<E, A>> { ... }

Added in v2.0.0

getApplySemigroup (function)

Signature

export function getApplySemigroup<E, A>(S: Semigroup<A>): Semigroup<IOEither<E, A>> { ... }

Added in v2.0.0

getFilterable (function)

Signature

export function getFilterable<E>(M: Monoid<E>): Filterable2C<URI, E> { ... }

Added in v2.1.0

getIOValidation (function)

Signature

export function getIOValidation<E>(
  S: Semigroup<E>
): Monad2C<URI, E> & Bifunctor2C<URI, E> & Alt2C<URI, E> & MonadIO2C<URI, E> & MonadThrow2C<URI, E> { ... }

Added in v2.0.0

getOrElse (function)

Signature

export function getOrElse<E, A>(onLeft: (e: E) => IO<A>): (ma: IOEither<E, A>) => IO<A> { ... }

Added in v2.0.0

getSemigroup (function)

Signature

export function getSemigroup<E, A>(S: Semigroup<A>): Semigroup<IOEither<E, A>> { ... }

Added in v2.0.0

orElse (function)

Signature

export function orElse<E, A, M>(onLeft: (e: E) => IOEither<M, A>): (ma: IOEither<E, A>) => IOEither<M, A> { ... }

Added in v2.0.0

tryCatch (function)

Constructs a new IOEither from a function that performs a side effect and might throw

Signature

export function tryCatch<E, A>(f: Lazy<A>, onError: (reason: unknown) => E): IOEither<E, A> { ... }

Added in v2.0.0

alt (export)

Signature

<E, A>(that: () => IOEither<E, A>) => (fa: IOEither<E, A>) => IOEither<E, A>

Added in v2.0.0

ap (export)

Signature

<E, A>(fa: IOEither<E, A>) => <B>(fab: IOEither<E, (a: A) => B>) => IOEither<E, B>

Added in v2.0.0

apFirst (export)

Signature

<E, B>(fb: IOEither<E, B>) => <A>(fa: IOEither<E, A>) => IOEither<E, A>

Added in v2.0.0

apSecond (export)

Signature

<E, B>(fb: IOEither<E, B>) => <A>(fa: IOEither<E, A>) => IOEither<E, B>

Added in v2.0.0

bimap (export)

Signature

<E, G, A, B>(f: (e: E) => G, g: (a: A) => B) => (fa: IOEither<E, A>) => IOEither<G, B>

Added in v2.0.0

chain (export)

Signature

<E, A, B>(f: (a: A) => IOEither<E, B>) => (ma: IOEither<E, A>) => IOEither<E, B>

Added in v2.0.0

chainFirst (export)

Signature

<E, A, B>(f: (a: A) => IOEither<E, B>) => (ma: IOEither<E, A>) => IOEither<E, A>

Added in v2.0.0

filterOrElse (export)

Signature

{ <E, A, B>(refinement: Refinement<A, B>, onFalse: (a: A) => E): (ma: IOEither<E, A>) => IOEither<E, B>; <E, A>(predicate: Predicate<A>, onFalse: (a: A) => E): (ma: IOEither<E, A>) => IOEither<E, A>; }

Added in v2.0.0

flatten (export)

Signature

<E, A>(mma: IOEither<E, IOEither<E, A>>) => IOEither<E, A>

Added in v2.0.0

fromEither (export)

Signature

<E, A>(ma: E.Either<E, A>) => IOEither<E, A>

Added in v2.0.0

fromOption (export)

Signature

<E>(onNone: () => E) => <A>(ma: Option<A>) => IOEither<E, A>

Added in v2.0.0

fromPredicate (export)

Signature

{ <E, A, B>(refinement: Refinement<A, B>, onFalse: (a: A) => E): (a: A) => IOEither<E, B>; <E, A>(predicate: Predicate<A>, onFalse: (a: A) => E): (a: A) => IOEither<E, A>; }

Added in v2.0.0

map (export)

Signature

<A, B>(f: (a: A) => B) => <E>(fa: IOEither<E, A>) => IOEither<E, B>

Added in v2.0.0

mapLeft (export)

Signature

<E, G>(f: (e: E) => G) => <A>(fa: IOEither<E, A>) => IOEither<G, A>

Added in v2.0.0