Packages

  • package root
    Definition Classes
    root
  • package org
    Definition Classes
    root
  • package specs2
    Definition Classes
    org
  • package control
    Definition Classes
    specs2
  • package eff
    Definition Classes
    control
  • 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.

    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

    Definition Classes
    eff
  • StateRecurse

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

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

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. StateRecurse
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. abstract type S

Abstract Value Members

  1. abstract def applicative[X, T[_]](xs: T[M[X]], s: S)(implicit arg0: Traverse[T]): Either[(T[X], S), (M[T[X]], S)]
  2. abstract def apply[X](x: M[X], s: S): (X, S)
  3. abstract def finalize(a: A, s: S): B
  4. abstract val init: S

Concrete 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 clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  6. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  7. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  8. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  9. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  10. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  11. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  12. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  13. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  14. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  15. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  16. def toString(): String
    Definition Classes
    AnyRef → Any
  17. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  18. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  19. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped