MonadError

trait MonadError[F[_]]

A basic monad interface, allowing abstract manipulation of effectful values, represented using the type constructor F.

A basic monad interface, allowing abstract manipulation of effectful values, represented using the type constructor F.

A computation yielding results of type T is represented as a value of type F[T]. Such values:

  • can be transformed using map
  • can be run in sequence using flatMap
  • errors can be handled using handleError
  • and new computations can be created using unit, eval and suspend

To use convenient .map, .flatMap syntax, make sure an implicit instance of MonadError is in scope, and import: import sttp.monad.syntax._. This adds the appropriate extension methods.

class Object
trait Matchable
class Any

Value members

Abstract methods

def ensure[T](f: F[T], e: => F[Unit]): F[T]
def error[T](t: Throwable): F[T]
def flatMap[T, T2](fa: F[T])(f: T => F[T2]): F[T2]
protected def handleWrappedError[T](rt: F[T])(h: PartialFunction[Throwable, F[T]]): F[T]
def map[T, T2](fa: F[T])(f: T => T2): F[T2]
def unit[T](t: T): F[T]

Concrete methods

def eval[T](t: => T): F[T]
def flatTap[T, U](fa: F[T])(f: T => F[U]): F[T]
def flatten[T](ffa: F[F[T]]): F[T]
def fromTry[T](t: Try[T]): F[T]
def handleError[T](rt: => F[T])(h: PartialFunction[Throwable, F[T]]): F[T]
def suspend[T](t: => F[T]): F[T]