Signature

trait Signature extends AnyRef

Base trait for any user-defined effect signature.

Effect signature is a trait, where the effect's operations are declared as abstract methods.

Typically, a custom defined Signature is 1-1 paired with a custom defined Effect.

Effect signatures play the same role as:

  • Algebras in Tagless Final.
  • Services in ZIO.

Example:

import turbolift.Signature

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

Effect operations must:

  • Be defined as abstract methods.
  • Have their return types of shape: X !@! ThisEffect, for some type X.

It may be helpful to think of !@![_, ThisEffect] as analogous to F[_] in Tagless Final. Except in Turbolift, it's meant to be used in the return type only.

In the parameters, plain !! should be used. Example of scoped operation:

trait ErrorSignature[E] extends Signature:
  def catchError[A, U <: ThisEffect](scope: A !! U)(f: E => A !! U): A !@! U
class Object
trait Matchable
class Any
trait AcyclicMemoizerSig[K, V]
trait AcyclicMemoizer[K, V]
trait AutoInc
trait CyclicMemoizerSig[K, V]
trait CyclicMemoizer[K, V]
trait MonoGraphSig[K, V]
trait MonoGraph[K, V]
trait PolyGraphSig[K, V]
trait PolyGraph[K, V]
trait CanPerform[Z]
trait Effect[Z]
trait Choice
object Each.type
object Fail.type
trait ErrorEffect[E, E1]
trait Error[E]
trait ErrorG[M, K, V]
trait ErrorGK[M, K, F, V]
trait ErrorK[F, E]
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]
trait Flow
class Stateful[S, F]
class Stateful[S, F]
class Stateless[F]
class Stateless[F]
trait Proxy[Fx]
class Proxy[Fx]
trait ChoiceSig
trait ErrorSig[E, E1]
trait ReaderSig[R]
trait StateSig[S]
trait WriterSig[W, W1]

Type members

Types

type !@![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.

From the perspective of effect's user, !@! is just an alias of !!. The final-override happens in Effect.

From the perspective of handler, !@! definition is enriched in a way depending on the chosen Interpreter.

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

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

From the perspective of effect's user, ThisEffect is just an alias of this.type. The final-override happens in Effect.

From the perspective of handler, ThisEffect definition is enriched in a way depending on the chosen Interpreter.