LazyMemoizerEffect

turbolift.effects.LazyMemoizerEffect
See theLazyMemoizerEffect companion object

Base trait for custom instances of LazyMemoizer effect.

case object MyLazyMemoizer extends LazyMemoizerEffect[Int, String]
// optional:
type MyLazyMemoizer = MyLazyMemoizer.type

Memoizes a recursive, effectful, lazy function. Like the MemoizerEffect, but this version can be used to build or transform cyclic data structures.

The price to pay is that that memo returns a thunk. The constructor of the cyclic data structure should store obtained thunks, rather than attempt to call them.

Calling obtained thunks BEFORE this effect is handled, may raise TieTheKnot exception and should be considered a defect.

Type parameters

K

input of the memoized function

V

output of the memoized function

Attributes

See also
Companion
object
Graph
Supertypes
trait LazyMemoizerSignature[K, V]
trait Signature
class Object
trait Matchable
class Any
Show all
Self type

Members list

Type members

Classlikes

object handlers

Predefined handlers for this effect.

Predefined handlers for this effect.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
handlers.type

Inherited types

final override type ThisEffect = Effect.this.type

Attributes

Inherited from:
Effect
type ThisSignature[U] = LazyMemoizerSignature[K, V] & Signature { type ThisEffect = U; }

API for defining custom effects.

API for defining custom effects.

Attributes

Inherited from:
Effect

Value members

Concrete methods

final def apply(k: K): Computation[() => V, this.type]
final override def domain: Computation[Set[K], this.type]

Snapshot of the domain.

Snapshot of the domain.

The set of all arguments that memo has been called so far.

Attributes

Definition Classes
def handler[U](f: K => Computation[V, U & thiz.type]): Handler[Identity, Identity, thiz.type, U]
Extension method from LazyMemoizerEffect

Alias of the default handler for this effect.

Alias of the default handler for this effect.

Defined as an extension, to allow custom redefinitions without restrictions imposed by overriding

Attributes

final override def memo(k: K): Computation[() => V, this.type]

Invoke the function being memoized.

Invoke the function being memoized.

The function being memoized is not specified, until the handler is called.

Attributes

Definition Classes
final override def toMap: Computation[Map[K, V], this.type]

Snapshot of the relation.

Snapshot of the relation.

The map from all arguments that memo has been called so far, to corresponding results.

Attributes

Definition Classes

Inherited methods

final def &![Fx2 <: Signature](fx2: Fx2): Combine2[Effect.this.type, fx2.type]

API for defining custom handlers.

API for defining custom handlers.

Combines with another Effect instance, for the purpose of sharing an Interpreter.

Example of application: implement RWS-alike handler for Reader &! Writer &! State composition of effects.

Attributes

Inherited from:
Effect
final inline def perform[A, U <: ThisEffect](inline f: (ThisSignature[U]) => Computation[A, U]): Computation[A, U]

API for defining custom effects.

API for defining custom effects.

Embeds an invocation of this Signature's method into the Computation monad. This provides mechanism for separation between syntax an semantics of effects.

Attributes

Inherited from:
Effect
final def performNoInline[A, U <: ThisEffect](f: (ThisSignature[U]) => Computation[A, U]): Computation[A, U]

API for defining custom effects.

API for defining custom effects.

Attributes

Inherited from:
Effect

Inherited fields

API for defining custom handlers.

API for defining custom handlers.

Helper object providing type definitions to be used for implementing Interpreters for this effect.

Attributes

Inherited from:
Effect

Exports

Inherited defined exports

final type ThisHandler = [F[_], G[_], N] =>> this.impl.ThisHandler[F, G, N]
Exported from Impl

Attributes

Inherited from:
Effect