Packages

trait Interpret extends AnyRef

The Interpret trait provides method to interpret (or "handle") effects.

An interpreter generally handles a given effect M and a value Eff[R, A] where M is a member of R.

The most general way of interpreting an effect is to implement the Interpreter trait for that effect and use the runInterpreter method. With the Interpreter trait you need to define:

  • what to do with pure values
  • what to do with an effect
  • what to do with a list of effects (the "applicative" case)
  • what to do with a "last" effect, in case of having side-effects to finalize resources (see the SafeEffect)

For each of those methods you get access to a continuation which you may or may not invoke to create the next effect in a sequence of effects. For example with the EitherEffect once you arrive on a Left value you don't trigger the continuation because there is no value to trigger it with.

There are also easier ways to define interpreters. The recurse method and the Recurser trait define:

  • onPure(a: A): B: how to map a pure value A to the result B
  • onEffect[X](mx: M[X]): X Either Eff[R, B]: either extract a value from the effect or return another effect
  • onApplicative[X](tx: T[M[X]]): T[X] Either M[T[X]]: either extract individual values from each effect or "sequence" the effect

Even simpler, the Translate trait does a translation from an effect M[X] to other effects in the stack.

There are also a few intercept methods to use an effect but still leave it in the stack

Linear Supertypes
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Interpret
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Type Members

  1. type of[F[_], G[_]] = AnyRef { type l[A] = F[G[A]] }

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def augment[R, T[_], O[_], A](eff: Eff[R, A])(w: Augment[T, O])(implicit memberT: MemberInOut[T, R], memberO: MemberIn[O, R]): Eff[R, A]

    Interpret the effect T with a side-effect O (see the write method below)

  6. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  7. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  8. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  9. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  10. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  11. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  12. def intercept[R, T[_], A, B](e: Eff[R, A])(interpreter: Interpreter[T, R, A, B])(implicit m: /=[T, R]): Eff[R, B]
  13. def interceptNat[R, T[_], A](effect: Eff[R, A])(nat: ~>[T, T])(implicit m: /=[T, R]): Eff[R, A]

    Intercept the values for one effect and transform them into other values for the same effect

  14. def interceptNatM[R, M[_], F[_], A](effect: Eff[R, A], nat: ~>[M, [A]M[F[A]]])(implicit m: MemberInOut[M, R], FT: Traverse[F], FM: Monad[F]): Eff[R, F[A]]

    Intercept the values for one effect, emitting new values for the same effect inside a monad which is interleaved in

  15. def interpretUnsafe[R, U, T[_], A](effect: Eff[R, A])(sideEffect: SideEffect[T])(implicit m: Aux[T, R, U]): Eff[U, A]

    interpret an effect by running side-effects

  16. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  17. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  18. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  19. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  20. def recurse[R, U, T[_], A, B](e: Eff[R, A])(recurser: Recurser[T, U, A, B])(implicit m: Aux[T, R, U]): Eff[U, B]

    Interpret an effect with a Recurser

  21. def runInterpreter[R, U, T[_], A, B](e: Eff[R, A])(interpreter: Interpreter[T, U, A, B])(implicit m: Aux[T, R, U]): Eff[U, B]
  22. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  23. def toString(): String
    Definition Classes
    AnyRef → Any
  24. def trace[R, T[_], A](eff: Eff[R, A])(implicit memberT: MemberInOut[T, R], memberW: MemberInOut[[β$4$]WriterT[[A]A, T[_], β$4$], R]): Eff[R, A]

    For a single effect T log every value of that effect

  25. def transform[SR, BR, U1, U2, TS[_], TB[_], A](effect: Eff[SR, A], nat: ~>[TS, TB])(implicit sr: Aux[TS, SR, U1], br: Aux[TB, BR, U2], into: IntoPoly[U1, U2]): Eff[BR, A]

    transform an effect into another one using a natural transformation, leaving the rest of the stack untouched

  26. def translate[R, U, T[_], A](effect: Eff[R, A])(tr: Translate[T, U])(implicit m: Aux[T, R, U]): Eff[U, A]

    Translate one effect of the stack into some of the other effects in the stack

  27. def translateInto[R, T[_], U, A](effect: Eff[R, A])(tr: Translate[T, U])(implicit t: /=[T, R], into: IntoPoly[R, U]): Eff[U, A]

    Translate one effect of the stack into other effects in a larger stack

  28. def translateNat[R, U, T[_], A](effects: Eff[R, A])(nat: ~>[T, [β$0$]Eff[U, β$0$]])(implicit m: Aux[T, R, U]): Eff[U, A]

    Translate one effect of the stack into some of the other effects in the stack Using a natural transformation

  29. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  30. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  31. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  32. def write[R, T[_], O, A](eff: Eff[R, A])(w: Write[T, O])(implicit memberT: MemberInOut[T, R], memberW: MemberIn[[β$1$]WriterT[[A]A, O, β$1$], R]): Eff[R, A]

    For each effect T add some "log statements" O using the Writer effect

Inherited from AnyRef

Inherited from Any

Ungrouped