Trait/Object

org.atnos.eff

Interpret

Related Docs: object Interpret | package eff

Permalink

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:

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:

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

Type Members

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

    Permalink

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 augment[R, T[_], O[_], A](eff: Eff[R, A])(w: Augment[T, O])(implicit m: MemberInOut[T, R]): Eff[prepend[O, R], A]

    Permalink

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

  6. def clone(): AnyRef

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

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

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

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

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

    Permalink
    Definition Classes
    AnyRef → Any
  12. def intercept[R, T[_], A, B](e: Eff[R, A])(interpreter: Interpreter[T, R, A, B])(implicit m: /=[T, R]): Eff[R, B]

    Permalink
  13. def interceptNat[R, T[_], A](effect: Eff[R, A])(nat: ~>[T, T])(implicit m: /=[T, R]): Eff[R, A]

    Permalink

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

    Permalink

    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]

    Permalink

    interpret an effect by running side-effects

  16. final def isInstanceOf[T0]: Boolean

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

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

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

    Permalink
    Definition Classes
    AnyRef
  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]

    Permalink

    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]

    Permalink
  22. final def synchronized[T0](arg0: ⇒ T0): T0

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

    Permalink
    Definition Classes
    AnyRef → Any
  24. def transform[SR, BR, U, TS[_], TB[_], A](effect: 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

  25. def translate[R, U, T[_], A](effect: 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

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

    Permalink

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

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

  28. final def wait(): Unit

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  31. 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

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

Inherited from AnyRef

Inherited from Any

Ungrouped