Trait/Object

org.atnos.eff

Interpret

Related Docs: object Interpret | package eff

Permalink

trait Interpret extends AnyRef

Support methods to create interpreters (or "effect handlers") for a given effect M and a value Eff[R, A] when M is a member of R.

Those methods guarantee a stack-safe behaviour when running on a large list of effects (in list.traverse(f) for example).

There are different types of supported interpreters:

  1. "interpret" + Recurse

This interpreter is used to handle effects which either return a value X from M[X] or stops with Eff[R, B] See an example of such an interpreter in Eval where we just evaluate a computation X for each Eval[X].

2. "interpretState" + StateRecurse

This interpreter is used to handle effects which either return a value X from M[X] or stops with Eff[R, B]

3. "interpretLoop" + Loop

The most generic kind of interpreter where we can even recurse in the case of Pure(a) (See ListEffect for such a use)

4. "intercept / interceptState / interceptLoop" methods are similar but they transform an effect to other effects in the same stack without removing it from the stack

5. "transform" to swap an effect T of a stack to another effect, using a Natural Transformation

6. "translate" to interpret one effect of a stack into other effects of the same stack using a Natural Transformation this is a specialized version of interpret + Recurse

7. "interpretUnsafe + SideEffect" when you have a side effecting function M[X] => X

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. All

Type Members

  1. trait StateRecurse[M[_], A, B] extends AnyRef

    Permalink

    Helper trait for computations which might produce several M[X] in a stack of effects and which need to keep some state around

    Helper trait for computations which might produce several M[X] in a stack of effects and which need to keep some state around

    This is typically the case for Writer or State which need to keep some state S after each evaluation Evaluating the effect M[X] might use the previous S value as shown in the apply method

    Finally when the Eff[R, A] returns an A, this one can be combined with the last state value to produce a B

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  6. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  7. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  8. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  9. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  10. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  11. def intercept[R, M[_], A, B](pure: (A) ⇒ Eff[R, B], recurse: Recurse[M, R, B])(effects: Eff[R, A])(implicit m: /=[M, R]): Eff[R, B]

    Permalink

    INTERPRET IN THE SAME STACK

  12. def intercept1[R, M[_], A, B](pure: (A) ⇒ B)(recurse: Recurse[M, R, B])(effects: Eff[R, A])(implicit m: /=[M, R]): Eff[R, B]

    Permalink

    simpler version of intercept where the pure value is just mapped to another type

  13. def interceptLoop[R, M[_], A, B](pure: (A) ⇒ Eff[R, B], loop: Loop[M, R, A, Eff[R, B], Eff[R, Unit]])(effects: Eff[R, A])(implicit m: /=[M, R]): Eff[R, B]

    Permalink

    intercept an effect and interpret it in the same stack.

    intercept an effect and interpret it in the same stack. This method is stack-safe

  14. def interceptLoop1[R, M[_], A, B](pure: (A) ⇒ B)(loop: Loop[M, R, A, Eff[R, B], Eff[R, Unit]])(effects: Eff[R, A])(implicit m: /=[M, R]): Eff[R, B]

    Permalink
  15. def interceptNat[R, T[_], A](effects: Eff[R, A])(nat: ~>[T, T])(implicit m: MemberInOut[T, R]): Eff[R, A]

    Permalink

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

  16. def interceptStatelessLoop[R, M[_], A, B](pure: (A) ⇒ Eff[R, B], loop: StatelessLoop[M, R, A, Eff[R, B], Eff[R, Unit]])(effects: Eff[R, A])(implicit m: /=[M, R]): Eff[R, B]

    Permalink
  17. def interceptStatelessLoop1[R, M[_], A, B](pure: (A) ⇒ B)(loop: StatelessLoop[M, R, A, Eff[R, B], Eff[R, Unit]])(effects: Eff[R, A])(implicit m: /=[M, R]): Eff[R, B]

    Permalink
  18. def interpret[R, U, M[_], A, B](pure: (A) ⇒ Eff[U, B], recurse: Recurse[M, U, B])(effects: Eff[R, A])(implicit m: Aux[M, R, U]): Eff[U, B]

    Permalink

    interpret the effect M in the R stack

  19. def interpret1[R, U, M[_], A, B](pure: (A) ⇒ B)(recurse: Recurse[M, U, B])(effects: Eff[R, A])(implicit m: Aux[M, R, U]): Eff[U, B]

    Permalink

    simpler version of interpret where the pure value is just mapped to another type

  20. def interpretLoop[R, U, M[_], A, B](pure: (A) ⇒ Eff[U, B], loop: Loop[M, R, A, Eff[U, B], Eff[U, Unit]])(effects: Eff[R, A])(implicit m: Aux[M, R, U]): Eff[U, B]

    Permalink

    generalization of interpret and interpretState

    generalization of interpret and interpretState

    This method contains a loop which is stack-safe

  21. def interpretLoop1[R, U, M[_], A, B](pure: (A) ⇒ B)(loop: Loop[M, R, A, Eff[U, B], Eff[U, Unit]])(effects: Eff[R, A])(implicit m: Aux[M, R, U]): Eff[U, B]

    Permalink
  22. def interpretState[R, U, M[_], A, B](pure: (A) ⇒ Eff[U, B], recurse: StateRecurse[M, A, B])(effects: Eff[R, A])(implicit m: Aux[M, R, U]): Eff[U, B]

    Permalink

    interpret the effect M in the M |: R stack, keeping track of some state

  23. def interpretState1[R, U, M[_], A, B](pure: (A) ⇒ B)(recurse: StateRecurse[M, A, B])(effects: Eff[R, A])(implicit m: Aux[M, R, U]): Eff[U, B]

    Permalink

    simpler version of interpret1 where the pure value is just mapped to another type

  24. def interpretStatelessLoop[R, U, M[_], A, B](pure: (A) ⇒ Eff[U, B], loop: StatelessLoop[M, R, A, Eff[U, B], Eff[U, Unit]])(effects: Eff[R, A])(implicit m: Aux[M, R, U]): Eff[U, B]

    Permalink

    generalization of interpret

    generalization of interpret

    This method contains a loop which is stack-safe

  25. def interpretStatelessLoop1[R, U, M[_], A, B](pure: (A) ⇒ B)(loop: StatelessLoop[M, R, A, Eff[U, B], Eff[U, Unit]])(effects: Eff[R, A])(implicit m: Aux[M, R, U]): Eff[U, B]

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

    Permalink

    interpret an effect by running side-effects

  27. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  28. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  29. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  30. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  31. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  32. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  33. def transform[SR, BR, U, TS[_], TB[_], A](r: Eff[SR, A], nat: ~>[TS, TB])(implicit sr: Aux[TS, SR, U], br: Aux[TB, BR, U]): Eff[BR, A]

    Permalink

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

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

    Permalink

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

  35. def translateInto[R, T[_], U, A](eff: Eff[R, A])(translate: Translate[T, U])(implicit m: MemberInOut[T, R], into: IntoPoly[R, U]): Eff[U, A]

    Permalink

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

  36. 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]

    Permalink

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

  37. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  38. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  39. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  40. def write[R, T[_], O, A](eff: Eff[R, A])(w: Write[T, O])(implicit m: MemberInOut[T, R]): Eff[prepend[[β$1$]WriterT[[A]A, O, β$1$], R], A]

    Permalink

Inherited from AnyRef

Inherited from Any

Ungrouped