org.specs2.control.eff

Interpret

trait Interpret extends AnyRef

Support methods to create an interpreter (or "effect handlers") for a given Eff[M |: R, A]. The aim being to "consume" just that effect and produce a value of type B with possibly other effects: Eff[R, B]

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

There are 3 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)

Linear Supertypes
AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Interpret
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Type Members

  1. trait Loop[M[_], R <: Effects, A, B] extends AnyRef

    Generalisation of Recurse and StateRecurse

  2. trait Recurse[M[_], R, A] extends AnyRef

    Helper trait for computations which might produce several M[X] in a stack of effects.

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

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

Value Members

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

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

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

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  7. def clone(): AnyRef

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

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

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

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

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

    Definition Classes
    AnyRef → Any
  13. def intercept[R <: Effects, M[_], A, B](pure: (A) ⇒ Eff[R, B], recurse: Recurse[M, R, B])(effects: Eff[R, A])(implicit m: Member[M, R]): Eff[R, B]

    INTERPRET IN THE SAME STACK

  14. def intercept1[R <: Effects, M[_], A, B](pure: (A) ⇒ B)(recurse: Recurse[M, R, B])(effects: Eff[R, A])(implicit m: Member[M, R]): Eff[R, B]

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

  15. def interceptLoop[R <: Effects, M[_], A, B, S](pure: (A) ⇒ Eff[R, B], loop: Loop[M, R, A, Eff[R, B]])(effects: Eff[R, A])(implicit m: Member[M, R]): Eff[R, B]

    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

  16. def interceptLoop1[R <: Effects, M[_], A, B, S](pure: (A) ⇒ B)(loop: Loop[M, R, A, Eff[R, B]])(effects: Eff[R, A])(implicit m: Member[M, R]): Eff[R, B]

  17. def interpret[R <: Effects, U <: Effects, 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]

    interpret the effect M in the M |: R stack

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

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

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

    generalization of interpret and interpretState

    generalization of interpret and interpretState

    This method contains a loop which is stack-safe

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

  21. def interpretState[R <: Effects, U <: Effects, 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]

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

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

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

  23. final def isInstanceOf[T0]: Boolean

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

    Definition Classes
    AnyRef
  25. final def notify(): Unit

    Definition Classes
    AnyRef
  26. final def notifyAll(): Unit

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

    Definition Classes
    AnyRef
  28. def toString(): String

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

    transform an effect into another one using a natural transformation

  30. final def wait(): Unit

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

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

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped