package eff
- Alphabetic
- By Inheritance
- eff
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
- type <=[M[_], R] = Member[M, R]
-
case class
Arrs
[R, A, B](functions: Vector[(Any) ⇒ Eff[R, Any]]) extends Product with Serializable
Sequence of monadic functions from A to B: A => Eff[B]
Sequence of monadic functions from A to B: A => Eff[B]
Internally it is represented as a Vector of functions:
A => Eff[R, X1]; X1 => Eff[R, X2]; X2 => Eff[R, X3]; ...; X3 => Eff[R, B]
- type Console[A] = AnyRef { ... /* 2 definitions in type refinement */ }
- trait ConsoleEffect extends AnyRef
- trait ConsoleImplicits extends ConsoleImplicits1
- trait ConsoleImplicits1 extends AnyRef
- trait ConsoleTag extends AnyRef
- trait DisjunctionCreation extends AnyRef
-
trait
DisjunctionEffect
extends DisjunctionCreation with DisjunctionInterpretation
Effect for computation which can fail
- trait DisjunctionInterpretation extends AnyRef
-
sealed
trait
Eff
[R, A] extends AnyRef
Effects of type R, returning a value of type A
Effects of type R, returning a value of type A
It is implemented as a "Free-er" monad with extensible effects:
- the "pure" case is a pure value of type A
- the "impure" case is:
- a disjoint union of possible effects
- a continuation of type X => Eff[R, A] indicating what to do if the current effect is of type M[X]
this type is represented by the
Arrstype
The monad implementation for this type is really simple:
pointis Purebindsimply appends the binding function to theArrscontinuation
Important:
The list of continuations is NOT implemented as a type sequence but simply as a Vector[Any => Eff[R, Any]]
This means that various
.asInstanceOfare present in the implementation and could lead to burns and severe harm. Use with caution!- See also
http://okmij.org/ftp/Haskell/extensible/more.pdf
- trait EffCreation extends AnyRef
- trait EffImplicits extends AnyRef
- trait EffInterpretation extends AnyRef
-
sealed
trait
Effect
[F[_]] extends AnyRef
one effect, basically a type constructor
-
trait
Effects
extends AnyRef
Effects is a type level representing a list of effects which might take place in a computation
Effects is a type level representing a list of effects which might take place in a computation
Note that each "effect" is a type constructor
-
final
case class
EffectsCons
[F[_], T <: Effects](head: Effect[F], tail: T) extends Effects with Product with Serializable
Append an effect at the beginning of a list of effects
- trait ErrorCreation [F] extends ErrorTypes[F]
-
trait
ErrorEffect
[F] extends ErrorCreation[F] with ErrorInterpretation[F]
Effect for computation which can fail and return a Throwable, or just stop with a failure
Effect for computation which can fail and return a Throwable, or just stop with a failure
This effect is a mix of Eval and \/ in the sense that every computation passed to this effect (with the ok method) is considered "impure" or "faulty" by default.
The type F is used to represent the failure type.
- trait ErrorInterpretation [F] extends ErrorCreation[F]
- trait ErrorTypes [F] extends AnyRef
- trait EvalCreation extends EvalTypes
-
trait
EvalEffect
extends EvalTypes with EvalCreation with EvalInterpretation
Effect for delayed computations
Effect for delayed computations
uses scalaz.Need as a supporting data structure
- trait EvalInterpretation extends EvalTypes
- trait EvalTypes extends AnyRef
-
trait
Fold
[A, B] extends AnyRef
support trait for folding values while possibly keeping some internal state
-
case class
Impure
[R, X, A](union: Union[R, X], continuation: Arrs[R, X, A]) extends Eff[R, A] with Product with Serializable
union is a disjoint union of effects returning a value of type X (not specified)
-
trait
Interpret
extends AnyRef
Support methods to create an interpreter (or "effect handlers") for a given Eff[M |: R, A].
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:
- 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)
-
trait
IntoPoly
[R <: Effects, U, A] extends AnyRef
Trait for polymorphic recursion into Eff[?, A]
Trait for polymorphic recursion into Eff[?, A]
The idea is to deal with one effect at the time:
- if the effect stack is M |: R and if U contains M we transform each "Union[R, X]" in the Impure case into a Union for U and we try to recurse on other effects present in R
- if the effect stack is M |: NoEffect and if U contains M we just "inject" the M[X] effect into Eff[U, A] using the Member typeclass if M is not present when we decompose we throw an exception. This case should never happen because if there is no other effect in the stack there should be at least something producing a value of type A
- trait IntoPolyLower extends AnyRef
- trait ListCreation extends AnyRef
-
trait
ListEffect
extends ListCreation with ListInterpretation
Effect for computations possibly returning several values
- trait ListInterpretation extends AnyRef
-
trait
Member
[T[_], R] extends AnyRef
Member typeclass for effects belonging to a stack of effects R
Member typeclass for effects belonging to a stack of effects R
If T is a member of R then we can:
- create a Union of effects from a single effect with "inject" - extract an effect value from a union if there is such an effect in the stack
- Annotations
- @implicitNotFound( ... )
- trait MemberImplicits extends MemberImplicits1
- trait MemberImplicits1 extends MemberImplicits2
- trait MemberImplicits2 extends AnyRef
-
class
NoEffect
extends Effects
Nil case for the list of effects
- trait OptionCreation extends AnyRef
-
trait
OptionEffect
extends OptionCreation with OptionInterpretation
Effect for optional computations
- trait OptionInterpretation extends AnyRef
- case class Pure [R, A](value: A) extends Eff[R, A] with Product with Serializable
- trait ReaderCreation extends AnyRef
-
trait
ReaderEffect
extends ReaderCreation with ReaderInterpretation with ReaderImplicits
Effect for computations depending on an environment.
Effect for computations depending on an environment.
The inside datatype for this effect is scalaz.Reader
Several Reader effects can be present in a given stack provided that they are tagged with scala.Tag.
A tagged Reader effect can be run with runTaggedReader
- trait ReaderImplicits extends ReaderImplicits1
- trait ReaderImplicits1 extends AnyRef
- trait ReaderInterpretation extends AnyRef
- trait StateCreation extends AnyRef
-
trait
StateEffect
extends StateCreation with StateInterpretation with StateImplicits
Effect for passing state along computations
Effect for passing state along computations
Several state effects can be used in the same stack if they are tagged
Internally backed up by scalaz.State
- trait StateImplicits extends StateImplicits1
- trait StateImplicits1 extends AnyRef
- trait StateInterpretation extends AnyRef
-
sealed
trait
Union
[+R, A] extends AnyRef
Open union of effects
Open union of effects
They are modelled as a list of
UnionNext(UnionNext(...(UnionNow(M[X])))
where M[X] is an effect. The depth of the nesting in an Union value corresponds to the place of the effect in a type E1 |: E2 |: E3 |: .. |: NoEffect
- case class UnionNext [O[_], R <: Effects, A](u: Union[R, A]) extends Union[eff.Effects.|:[O, R], A] with Product with Serializable
- case class UnionNow [T[_], R <: Effects, A](ta: T[A]) extends Union[eff.Effects.|:[T, R], A] with Product with Serializable
- type Warnings[A] = AnyRef { ... /* 2 definitions in type refinement */ }
- trait WarningsEffect extends AnyRef
- trait WarningsImplicits extends WarningsImplicits1
- trait WarningsImplicits1 extends AnyRef
- trait WarningsTag extends AnyRef
- trait WriterCreation extends AnyRef
-
trait
WriterEffect
extends WriterCreation with WriterInterpretation
Effect for logging values alongside computations
Effect for logging values alongside computations
Compared to traditional Writer monad which accumulates values by default this effect can be interpreted in different ways:
- log values to the console or to a file as soon as they are produced
- accumulate values in a list
Several writer effects can be used in the same stack if they are tagged.
- trait WriterInterpretation extends AnyRef
Value Members
- object Arrs extends Serializable
- object ConsoleEffect extends ConsoleEffect
- object ConsoleImplicits extends ConsoleImplicits
- object DisjunctionCreation extends DisjunctionCreation
- object DisjunctionEffect extends DisjunctionEffect
- object DisjunctionInterpretation extends DisjunctionInterpretation
- object Eff extends EffCreation with EffInterpretation with EffImplicits
- object EffCreation extends EffCreation
- object EffImplicits extends EffImplicits
- object EffInterpretation extends EffInterpretation
-
object
Effects
extends Effects
Aliases for declaring effects with the following syntax
Aliases for declaring effects with the following syntax
A |: B |: C |: NoEffect
-
object
ErrorEffect
extends ErrorEffect[String]
Simple instantiation of the ErrorEffect trait with String as a Failure type
- object EvalEffect extends EvalEffect
- object EvalInterpretation extends EvalInterpretation
- object EvalTypes extends EvalTypes
- object Interpret extends Interpret
- object IntoPoly extends IntoPolyLower
- object ListCreation extends ListCreation
- object ListEffect extends ListEffect
- object ListInterpretation extends ListInterpretation
- object Member extends MemberImplicits
- object NoEffect extends NoEffect
- object OptionCreation extends OptionCreation
- object OptionEffect extends OptionEffect
- object OptionInterpretation extends OptionInterpretation
- object ReaderCreation extends ReaderCreation
- object ReaderEffect extends ReaderEffect
- object ReaderImplicits extends ReaderImplicits
- object ReaderInterpretation extends ReaderInterpretation
- object StateCreation extends StateCreation
- object StateEffect extends StateEffect
- object StateImplicits extends StateImplicits
- object StateInterpretation extends StateInterpretation
-
object
Union
create union objects
- object WarningsEffect extends WarningsEffect
- object WarningsImplicits extends WarningsImplicits
- object WriterCreation extends WriterCreation
- object WriterEffect extends WriterEffect
- object WriterInterpretation extends WriterInterpretation
- object all extends ConsoleEffect with WarningsEffect with ReaderEffect with WriterEffect with StateEffect with EvalEffect with OptionEffect with ListEffect with DisjunctionEffect with EffInterpretation with EffCreation with EffImplicits with Effects
- object console extends ConsoleEffect with ConsoleImplicits
- object disjunction extends DisjunctionCreation with DisjunctionInterpretation
- object eff extends EffCreation with EffInterpretation with Effects
- object eval extends EvalCreation with EvalInterpretation
- object interpret extends Interpret
- object list extends ListCreation with ListInterpretation
- object option extends OptionCreation with OptionInterpretation
- object reader extends ReaderCreation with ReaderInterpretation
- object state extends StateCreation with StateInterpretation
- object warnings extends WarningsEffect with WarningsImplicits
- object writer extends WriterCreation with WriterInterpretation