turbolift
Members list
Type members
Classlikes
Monad parametrized by a set of requested effect. Use the !!
infix type alias instead.
Monad parametrized by a set of requested effect. Use the !!
infix type alias instead.
Type-level set of effects is modelled with intersection types.
Type Any
means empty set.
type MyComputationType1 = String !! (MyState & MyError)
type MyComputationType2 = String !! Any
Attributes
- A
Result of the computation
- U
Type-level set of effects requested by this computation.
- Companion:
- object
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
Use the !!
alias to access methods of this companion object.
Use the !!
alias to access methods of this companion object.
Example:
import turbolift.!!
val myComputation: Int !! Any = !!.pure(42)
Attributes
- Companion:
- class
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
- Self type
- Computation.type
Base trait for any user-defined effect.
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]
Orphaned extensions.
Orphaned extensions.
import turbolift.Extensions._`
Attributes
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
- Self type
- Extensions.type
Used to delimit scope of effect(s).
Used to delimit scope of effect(s).
Handler transforms a Computation, by discharging some or all of its requested effects, and (optionally) introducing handlers own dependencies to it (set of effects used to create the handler).
val myComputation2 = myComputation1.handleWith(myHandler)
Handlers can be obtained:
- By implementing an Interpreter for an Effect, and then, obtaining a Handler from it.
- By transforming a preexisting handler, e.g.
val myHandler2 = myHandler1.map(...)
- By composing 2 preexisting handlers, e.g.
val myHandler3 = myHandler1 &&&! myHandler2
Compositon of 2 handlers is always sequential: the operands are applied in left to right order.
Attributes
- Elim
Type-level set of effects, that this handler eliminates from the computation.
- Intro
Type-level set of effects, that this handler introduces into the computation. This is often an empty set, expressed as
Any
.- Result
Type constructor (e.g.
Option[_]
), in which the computation's result is wrapped, after application of this handler. This is often an identity.- Companion:
- object
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
Base trait for any user-defined effect signature. Used to define custom Algebra/Service/DSL.
Base trait for any user-defined effect signature. Used to define custom Algebra/Service/DSL.
Example:
import turbolift.Signature
trait GoogleSignature extends Signature:
def countPicturesOf(topic: String): Int !@! ThisEffect
Attributes
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
- Known subtypes
- trait ChoiceSigtrait ChoiceEffecttrait Choiceobject Each.typeobject Fail.typetrait ConsoleSigtrait ConsoleEffectobject Console.typetrait Error[E]trait RandomSigtrait RandomEffectobject Random.typetrait ReaderSig[R]trait Reader[R]trait StateSig[S]trait State[S]trait Writer[W]trait CanPerform[Z]trait Effect[Z]trait Interpretertrait FlowFeaturesclass Flowclass Stateless[F]class Stateless[F]trait Proxy[Fx]class Proxy[Fx]
Types
Alias for Computation type. Meant to be used in infix form.
Value members
Concrete methods
Alias for Computation companion object.