ErrorEffectExt

turbolift.effects.ErrorEffectExt
See theErrorEffectExt companion object
trait ErrorEffectExt[E, E1] extends Effect[ErrorSignature[E, E1]], ErrorSignature[E, E1]

Base trait for custom instances of Error effect.

case object MyError extends ErrorEffect[String]
// optional:
type MyError = MyError.type

This effect covers both applicative-error and monadic-error. The behavior depends on:

  • selected handler: first vs. all
  • composition of computations: sequential (flatMap, zip, etc.) vs. parallel (zipPar, etc.).

Notice that ErrorEffectExt takes type 2 parameters. This abstraction enables ergonomic syntax of raise(e), which relieves the user from the necessity of wrapping e in Nel (raise(Nel(e))), as in the standard Validated applicative functor. For the simpler, single-parmeter version, see ErrorEffect.

Type parameters

E

Accumulated error

E1

Singular error added to the accumulator (commonly same as E)

Attributes

See also
Companion
object
Graph
Supertypes
trait ErrorSignature[E, E1]
trait Signature
trait Effect[ErrorSignature[E, E1]]
class Object
trait Matchable
class Any
Show all
Known subtypes
trait ErrorEffect[E]
trait ErrorEffectG[M, K, V]
trait ErrorEffectGK[M, K, F, V]
trait ErrorEffectK[F, E]
Self type

Members list

Type members

Classlikes

object handlers

Predefined handlers for this effect.

Predefined handlers for this effect.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
handlers.type

Inherited types

final override type ThisEffect = Effect.this.type

Attributes

Inherited from:
Effect
type ThisSignature[U] = ErrorSignature[E, E1] & Signature { type ThisEffect = U; }

API for defining custom effects.

API for defining custom effects.

Attributes

Inherited from:
Effect

Value members

Concrete methods

final def catchAll[A, U <: ErrorEffectExt[E, E1]](body: Computation[A, U])(f: E => A): Computation[A, U]
final def catchAllEff[A, U <: ErrorEffectExt[E, E1]](body: Computation[A, U])(f: E => Computation[A, U]): Computation[A, U]
final def catchSome[A, U <: ErrorEffectExt[E, E1]](body: Computation[A, U])(f: PartialFunction[E, A]): Computation[A, U]
final def catchSomeEff[A, U <: ErrorEffectExt[E, E1]](body: Computation[A, U])(f: PartialFunction[E, Computation[A, U]]): Computation[A, U]
final override def catchToEither[A, U <: ErrorEffectExt[E, E1]](body: Computation[A, U]): Computation[Either[E, A], U]

Attributes

Definition Classes
def handler(using E: One[E, E1]): Handler[Identity, [_] =>> Either[E, _$11], thiz.type, Any]
Extension method from ErrorEffectExt

Alias of the default handler for this effect.

Alias of the default handler for this effect.

Defined as an extension, to allow custom redefinitions without restrictions imposed by overriding

Attributes

final override def raise(e: E1): Computation[Nothing, this.type]

Attributes

Definition Classes
final def raise[K, V1](k: K, v: V1)(using ev: (K, V1) <:< E1): Computation[Unit, this.type]
final def raiseFromEither[A](x: Either[E1, A]): Computation[A, this.type]
final def raiseFromOption[A](x: Option[A])(e: => E1): Computation[A, this.type]
final def raiseFromTry[A](x: Try[A])(using ev: Throwable <:< E1): Computation[A, this.type]
final override def raises(e: E): Computation[Nothing, this.type]

Attributes

Definition Classes
final def raises[K, V](k: K, v: V)(using ev: (K, V) <:< E): Computation[Unit, this.type]

Deprecated methods

final def fromEither[A](x: Either[E1, A]): Computation[A, this.type]

Attributes

Deprecated
true
final def fromOption[A](x: Option[A])(e: => E1): Computation[A, this.type]

Attributes

Deprecated
true
final def fromTry[A](x: Try[A])(using ev: Throwable <:< E1): Computation[A, this.type]

Attributes

Deprecated
true

Inherited methods

final def &![Fx2 <: Signature](fx2: Fx2): Combine2[Effect.this.type, fx2.type]

API for defining custom handlers.

API for defining custom handlers.

Combines with another Effect instance, for the purpose of sharing an Interpreter.

Example of application: implement RWS-alike handler for Reader &! Writer &! State composition of effects.

Attributes

Inherited from:
Effect
final inline def perform[A, U <: ThisEffect](inline f: (ThisSignature[U]) => Computation[A, U]): Computation[A, U]

API for defining custom effects.

API for defining custom effects.

Embeds an invocation of this Signature's method into the Computation monad. This provides mechanism for separation between syntax an semantics of effects.

Attributes

Inherited from:
Effect
final def performNoInline[A, U <: ThisEffect](f: (ThisSignature[U]) => Computation[A, U]): Computation[A, U]

API for defining custom effects.

API for defining custom effects.

Attributes

Inherited from:
Effect

Deprecated and Inherited methods

final def toEither[A, U <: ThisEffect](body: Computation[A, U]): Computation[Either[E, A], U]

Attributes

Deprecated
true
Inherited from:
ErrorSignature

Inherited fields

val impl: Impl[ErrorEffectExt[E, E1]]

API for defining custom handlers.

API for defining custom handlers.

Helper object providing type definitions to be used for implementing Interpreters for this effect.

Attributes

Inherited from:
Effect

Exports

Inherited defined exports

final type ThisHandler = [F[_], G[_], N] =>> this.impl.ThisHandler[F, G, N]
Exported from Impl

Attributes

Inherited from:
Effect