MonadThrow overview

The MonadThrow type class represents those monads which support errors via throwError, where throwError(e) halts, yielding the error e.

Laws:

  • Left zero: M.chain(M.throwError(e), f) = M.throwError(e)

Added in v2.0.0


Table of contents


model

MonadThrow (interface)

Signature

export interface MonadThrow<M> extends Monad<M> {
  readonly throwError: <E, A>(e: E) => HKT<M, A>
}

Added in v2.0.0

MonadThrow1 (interface)

Signature

export interface MonadThrow1<M extends URIS> extends Monad1<M> {
  readonly throwError: <E, A>(e: E) => Kind<M, A>
}

Added in v2.0.0

MonadThrow2 (interface)

Signature

export interface MonadThrow2<M extends URIS2> extends Monad2<M> {
  readonly throwError: <E, A>(e: E) => Kind2<M, E, A>
}

Added in v2.0.0

MonadThrow2C (interface)

Signature

export interface MonadThrow2C<M extends URIS2, E> extends Monad2C<M, E> {
  readonly throwError: <A>(e: E) => Kind2<M, E, A>
}

Added in v2.0.0

MonadThrow3 (interface)

Signature

export interface MonadThrow3<M extends URIS3> extends Monad3<M> {
  readonly throwError: <R, E, A>(e: E) => Kind3<M, R, E, A>
}

Added in v2.0.0

MonadThrow3C (interface)

Signature

export interface MonadThrow3C<M extends URIS3, E> extends Monad3C<M, E> {
  readonly throwError: <R, A>(e: E) => Kind3<M, R, E, A>
}

Added in v2.2.0

MonadThrow4 (interface)

Signature

export interface MonadThrow4<M extends URIS4> extends Monad4<M> {
  readonly throwError: <S, R, E, A>(e: E) => Kind4<M, S, R, E, A>
}

Added in v2.0.0