Effect

turbolift.Effect
See theEffect companion object
trait Effect[Z <: Signature] extends CanPerform[Z], CanInterpret

Base trait for any user-defined effect.

Instances of Effect are used for:

  • Establishing unique identity of the effect.
  • Invoking operations of the effect.

Example:

import turbolift.{!!, Signature, Effect}}

// Signature:
trait GoogleSignature extends Signature:
 def countPicturesOf(topic: String): Int !@! ThisEffect

// Boilerplate:
trait Google extends Effect[GoogleSignature] with GoogleSignature:
 final override def countPicturesOf(topic: String) = perform(_.countPicturesOf(topic))

// Instantiaton establishes the identity:
case object MyGoogle extends Google
type MyGoogle = MyGoogle.type

// Invoking operations:
val program: Int !! MyGoogle = MyGoogle.countPicturesOf("cat")

For details, see Defining your own effects and handlers.

Type parameters

Z

The Signature of this effect.

Attributes

Companion
object
Graph
Supertypes
trait CanInterpret
trait CanPerform[Z]
trait Signature
class Object
trait Matchable
class Any
Show all
Known subtypes
trait ChoiceEffect
trait Choice
object Each.type
object Fail.type
object Console.type
trait ErrorEffect[E, E1]
trait Error[E]
trait ErrorG[M, K, V]
trait ErrorGK[M, K, F, V]
trait ErrorK[F, E]
trait RandomEffect
object Random.type
trait Reader[R]
trait State[S]
trait WriterEffect[W, W1]
trait Writer[W]
trait WriterG[M, K, V]
trait WriterGK[M, K, F, V]
trait WriterK[F, W]
Show all
Self type
Effect[Z]

Members list

Type members

Inherited classlikes

abstract class ConstStateful[C, S, F[_]] extends Stateful[S, [_] =>> C, F], ThisInterpreter

Like Stateful, but obtained handler is applicable only to computations that return C.

Like Stateful, but obtained handler is applicable only to computations that return C.

Attributes

Inherited from:
CanInterpret
Supertypes
class Stateful[S, [_] =>> C, F]
class Flow
class FlowFeatures
trait Interpreter
trait Signature
class Object
trait Matchable
class Any
Show all
abstract class ConstStateless[C, F[_]] extends Stateless[[_] =>> C, F], ThisInterpreter

Like Stateless, but obtained handler is applicable only to computations that return C.

Like Stateless, but obtained handler is applicable only to computations that return C.

Attributes

Inherited from:
CanInterpret
Supertypes
class Stateless[[_] =>> C, F]
class Flow
class FlowFeatures
trait Interpreter
trait Signature
class Object
trait Matchable
class Any
Show all
abstract class Proxy[Fx] extends Proxy[Fx], ThisInterpreter

Base class for any user-defined proxy interpreter for this effect.

Base class for any user-defined proxy interpreter for this effect.

Like Proxy Interpreter, but specialized for this effect.

Attributes

Inherited from:
CanInterpret
Supertypes
class Proxy[Fx]
trait Interpreter
trait Signature
class Object
trait Matchable
class Any
Show all
abstract class ProxyIO extends ProxyIO, ThisInterpreter

Attributes

Inherited from:
CanInterpret
Supertypes
class ProxyIO
trait Interpreter
trait Signature
class Object
trait Matchable
class Any
Show all
abstract class Stateful[S, F[_]] extends Stateful[S, [X] =>> X, F], ThisInterpreter

Base class for any user-defined stateful interpreter for this effect.

Base class for any user-defined stateful interpreter for this effect.

Like Stateful Interpreter, but specialized for this effect.

Attributes

Inherited from:
CanInterpret
Supertypes
class Stateful[S, [X] =>> X, F]
class Flow
class FlowFeatures
trait Interpreter
trait Signature
class Object
trait Matchable
class Any
Show all
abstract class Stateless[F[_]] extends Stateless[[X] =>> X, F], ThisInterpreter

Base class for any user-defined stateless interpreter for this effect.

Base class for any user-defined stateless interpreter for this effect.

Like Stateless Interpreter, but specialized for this effect.

Attributes

Inherited from:
CanInterpret
Supertypes
class Stateless[[X] =>> X, F]
class Flow
class FlowFeatures
trait Interpreter
trait Signature
class Object
trait Matchable
class Any
Show all
object ThisHandler

Defines type aliases for Handler, specialized to eliminate this effect.

Defines type aliases for Handler, specialized to eliminate this effect.

Attributes

Inherited from:
CanInterpret
Supertypes
class Object
trait Matchable
class Any
sealed trait ThisInterpreter

Attributes

Inherited from:
CanInterpret
Supertypes
trait Interpreter
trait Signature
class Object
trait Matchable
class Any
Known subtypes
class ConstStateful[C, S, F]
class ConstStateless[C, F]
class Proxy[Fx]
class ProxyIO
class Stateful[S, F]
class Stateless[F]
Show all

Types

final override type ThisEffect = Effect.this.type

Abstract type that must be used in definitions of effect's operations.

Abstract type that must be used in definitions of effect's operations.

Becomes an alias of this.type, once the signature is inherited from Effect.

Attributes

Inherited types

final override type !@![+A, U] = Computation[A, U]

Abstract type that must be used in definitions of effect's operations.

Abstract type that must be used in definitions of effect's operations.

Becomes an alias of Computation (i.e. same as !!), once the signature is inherited from Effect.

Attributes

Inherited from:
CanPerform
final type ThisHandler[F[_], G[_], N] = Handler[F, G, ThisEffect, N]

Alias for Handler, specialized to eliminate this effect.

Alias for Handler, specialized to eliminate this effect.

Attributes

Inherited from:
CanInterpret

Value members

Concrete methods

final def &![Fx2 <: HasSignature](fx2: Fx2): Combine2[Effect, Fx2]

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

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

Attributes

Inherited methods

final def perform[A, U <: ThisEffect](f: (z: Z & Signature { type ThisEffect = U; }) => A !@! U): Computation[A, U]

Lifts an invocation of this Signature's method into the Computation monad.

Lifts an invocation of this Signature's method into the Computation monad.

Attributes

Inherited from:
CanPerform
final def pure[A](a: A): Computation[A, ThisEffect]

Like !!.pure(a), but with effect-set up-casted to ThisEffect

Like !!.pure(a), but with effect-set up-casted to ThisEffect

Attributes

Inherited from:
CanPerform

Exports

Inherited defined exports

final val Parallel: Parallel.type
Exported from Features

Attributes

Inherited from:
CanInterpret
final type Parallel = Parallel
Exported from Features$

Attributes

Inherited from:
CanInterpret
final type Sequential = Sequential
Exported from Features$

Attributes

Inherited from:
CanInterpret