turbolift.Effect
See theEffect companion object
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}}
trait GoogleSignature extends Signature:
def countPicturesOf(topic: String): Int !@! ThisEffect
// Boilerplate:
trait Google extends Effect[GoogleSignature] with GoogleSignature:
final override def countPicturesOf(topic: String): Int !! this.type = 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.
Attributes
- Z
The Signature of this effect.
- Companion:
- object
- Graph
- Supertypes
- Known subtypes
- trait ChoiceEffecttrait Choiceobject Each.typeobject Fail.typetrait ConsoleEffectobject Console.typetrait Error[E]trait RandomEffectobject Random.typetrait Reader[R]trait State[S]trait Writer[W]
- Self type
- Effect[Z]