turbolift.effects

Members list

Type members

Classlikes

case object Alternative extends ChoiceSignature

Virtual instance of ChoiceEffect

Virtual instance of ChoiceEffect

Allows invoking operations of ChoiceEffect, without the need of knowing its concrete instance. Alternative is designed to "match" the nearest (innermost) instance of ChoiceEffect currently present in the effect stack.

This is needed for making the following mechanisms to work:

  • Guards in for comprehensions use Alternative.empty
  • Binary operators +! and ++! (similar to <+> from Cats) use plus and plusPar.

Attributes

Supertypes
trait Singleton
trait Product
trait Mirror
trait Serializable
trait Product
trait Equals
trait Signature
class Object
trait Matchable
class Any
Show all
Self type
case object Broken extends MaybeEffect

Predefined instance of MaybeEffect, used by io.EffectfulVar.

Predefined instance of MaybeEffect, used by io.EffectfulVar.

Attributes

Supertypes
trait Singleton
trait Product
trait Mirror
trait Serializable
trait Product
trait Equals
trait MaybeEffect
trait Signature
class Object
trait Matchable
class Any
Show all
Self type
Broken.type
case object Choice extends ChoiceEffect

Predefined instance of ChoiceEffect.

Predefined instance of ChoiceEffect.

Attributes

Supertypes
trait Singleton
trait Product
trait Mirror
trait Serializable
trait Product
trait Equals
trait ChoiceEffect
trait Signature
class Object
trait Matchable
class Any
Show all
Self type
Choice.type

Base trait for custom instances of Choice effect.

Base trait for custom instances of Choice effect.

case object MyChoice extends ChoiceEffect
// optional:
type MyChoice = MyChoice.type

Attributes

See also
Companion
object
Supertypes
trait Signature
class Object
trait Matchable
class Any
Show all
Known subtypes
object Choice
object Each
Self type
object ChoiceEffect

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
trait ChoiceSignature extends Signature

Signature of ChoiceEffect.

Signature of ChoiceEffect.

Attributes

Supertypes
trait Signature
class Object
trait Matchable
class Any
Known subtypes
object Alternative
trait ChoiceEffect
object Choice
object Each
case object Console extends ConsoleEffect

Predefined instance of ConsoleEffect.

Predefined instance of ConsoleEffect.

Attributes

Supertypes
trait Singleton
trait Product
trait Mirror
trait Serializable
trait Product
trait Equals
trait AnsiColor
trait Signature
class Object
trait Matchable
class Any
Show all
Self type
Console.type

Base trait for custom instances of Console effect.

Base trait for custom instances of Console effect.

case object MyConsole extends ConsoleEffect
// optional:
type MyConsole = MyConsole.type

Effectful version of scala.Console

Attributes

See also
Companion
object
Supertypes
trait AnsiColor
trait Signature
class Object
trait Matchable
class Any
Show all
Known subtypes
object Console
Self type
object ConsoleEffect

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
trait ConsoleSignature extends Signature

Signature of ConsoleEffect.

Signature of ConsoleEffect.

Attributes

Supertypes
trait Signature
class Object
trait Matchable
class Any
Known subtypes
object Console
trait Cont[R] extends Effect[ContSignature[R]], ContSignature[R]

Attributes

Supertypes
trait ContSignature[R]
trait Signature
trait Effect[ContSignature[R]]
class Object
trait Matchable
class Any
Show all
Self type
Cont[R]
trait ContSignature[R] extends Signature

Signature of Cont effect.

Signature of Cont effect.

Attributes

Supertypes
trait Signature
class Object
trait Matchable
class Any
Known subtypes
trait Cont[R]
trait CoroutineEffect[I, O, R] extends Effect[CoroutineSignature[I, O, R]], CoroutineSignature[I, O, R]

Base trait for custom instances of Coroutine effect.

Base trait for custom instances of Coroutine effect.

case object MyCoroutine extends CoroutineEffect[Int, String, Unit]
// optional:
type MyCoroutine = MyCoroutine.type

Type parameters

I

value passed to the coroutine when it's resumed

O

value returned by the coroutine when it suspends

R

value returned by the coroutine when it ends

Attributes

See also
Companion
object
Supertypes
trait CoroutineSignature[I, O, R]
trait Signature
trait Effect[CoroutineSignature[I, O, R]]
class Object
trait Matchable
class Any
Show all
Self type
CoroutineEffect[I, O, R]

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
trait CoroutineSignature[I, O, R] extends Signature

Signature of CoroutineEffect.

Signature of CoroutineEffect.

Attributes

Supertypes
trait Signature
class Object
trait Matchable
class Any
Known subtypes
trait CoroutineEffect[I, O, R]
case object Each extends ChoiceEffect

Predefined instance of ChoiceEffect.

Predefined instance of ChoiceEffect.

Attributes

Supertypes
trait Singleton
trait Product
trait Mirror
trait Serializable
trait Product
trait Equals
trait ChoiceEffect
trait Signature
class Object
trait Matchable
class Any
Show all
Self type
Each.type
case object Error extends PolyErrorEffect

Predefined instance of PolyErrorEffect.

Predefined instance of PolyErrorEffect.

Note that using predefined effect instances like this, is anti-modular. However, they can be convenient in exploratory code.

Attributes

Supertypes
trait Singleton
trait Product
trait Mirror
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
Self type
Error.type
trait ErrorEffect[E] extends ErrorEffectExt[E, E]

Specialized ErrorEffectExt, where E and E1 are the same (e.g. a semigroup).

Specialized ErrorEffectExt, where E and E1 are the same (e.g. a semigroup).

Attributes

Supertypes
trait ErrorEffectExt[E, E]
trait ErrorSignature[E, E]
trait Signature
trait Effect[ErrorSignature[E, E]]
class Object
trait Matchable
class Any
Show all
trait ErrorEffectExt[E, E1] extends Effect[ErrorSignature[E, E1]], ErrorSignature[E, E1]

Base trait for custom instances of Error effect.

Base trait for custom instances of Error effect.

case object MyError extends ErrorEffect[String]
// optional:
type MyError = MyError.type

This effect covers both applicative-error and monadic-error. The behavior depends on:

  • selected handler: first vs. all
  • composition of computations: sequential (flatMap, zip, etc.) vs. parallel (zipPar, etc.).

Notice that ErrorEffectExt takes type 2 parameters. This abstraction enables ergonomic syntax of raise(e), which relieves the user from the necessity of wrapping e in Nel (raise(Nel(e))), as in the standard Validated applicative functor. For the simpler, single-parmeter version, see ErrorEffect.

Type parameters

E

Accumulated error

E1

Singular error added to the accumulator (commonly same as E)

Attributes

See also
Companion
object
Supertypes
trait ErrorSignature[E, E1]
trait Signature
trait Effect[ErrorSignature[E, E1]]
class Object
trait Matchable
class Any
Show all
Known subtypes
trait ErrorEffect[E]
trait ErrorEffectG[M, K, V]
trait ErrorEffectGK[M, K, F, V]
trait ErrorEffectK[F, E]
Self type

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
trait ErrorEffectG[M[_, _], K, V] extends ErrorEffectExt[M[K, V], (K, V)]

Specialized ErrorEffectExt, where pairs (K, V) are accumulated into M[K, V] (e.g. a map).

Specialized ErrorEffectExt, where pairs (K, V) are accumulated into M[K, V] (e.g. a map).

Attributes

Supertypes
trait ErrorEffectExt[M[K, V], (K, V)]
trait ErrorSignature[M[K, V], (K, V)]
trait Signature
trait Effect[ErrorSignature[M[K, V], (K, V)]]
class Object
trait Matchable
class Any
Show all
trait ErrorEffectGK[M[_, _], K, F[_], V] extends ErrorEffectExt[M[K, F[V]], (K, V)]

Specialized ErrorEffectExt, where pairs (K, V) are accumulated into M[K, F[V]] (e.g. a map of collections).

Specialized ErrorEffectExt, where pairs (K, V) are accumulated into M[K, F[V]] (e.g. a map of collections).

Attributes

Supertypes
trait ErrorEffectExt[M[K, F[V]], (K, V)]
trait ErrorSignature[M[K, F[V]], (K, V)]
trait Signature
trait Effect[ErrorSignature[M[K, F[V]], (K, V)]]
class Object
trait Matchable
class Any
Show all
trait ErrorEffectK[F[_], E] extends ErrorEffectExt[F[E], E]

Specialized ErrorEffectExt, where errors E are accumulated into F[E] (e.g. a collection).

Specialized ErrorEffectExt, where errors E are accumulated into F[E] (e.g. a collection).

Attributes

Supertypes
trait ErrorEffectExt[F[E], E]
trait ErrorSignature[F[E], E]
trait Signature
trait Effect[ErrorSignature[F[E], E]]
class Object
trait Matchable
class Any
Show all
trait ErrorSignature[E, E1] extends Signature

Signature of ErrorEffectExt.

Signature of ErrorEffectExt.

Type parameters

E

Accumulated error

E1

Singular error added to the accumulator (commonly same as E)

Attributes

Supertypes
trait Signature
class Object
trait Matchable
class Any
Known subtypes
trait ErrorEffectExt[E, E1]
trait ErrorEffect[E]
trait ErrorEffectG[M, K, V]
trait ErrorEffectGK[M, K, F, V]
trait ErrorEffectK[F, E]
sealed trait IO extends Signature

Attributes

Companion
object
Supertypes
trait Signature
class Object
trait Matchable
class Any
Known subtypes
object IO
case object IO extends IO

The sole instance of IO effect.

The sole instance of IO effect.

Unlike other effects, it cannot be interpreted/handled by the user. Once introduced into computation, it stays there forever. That is, until unsafeRun.

Attributes

Companion
trait
Supertypes
trait Singleton
trait Product
trait Mirror
trait Serializable
trait Product
trait Equals
trait IO
trait Signature
class Object
trait Matchable
class Any
Show all
Self type
IO.type
case object LazyMemoizer extends PolyLazyMemoizerEffect

Predefined instance of PolyLazyMemoizerEffect effect.

Predefined instance of PolyLazyMemoizerEffect effect.

Note that using predefined effect instances like this, is anti-modular. However, they can be convenient in exploratory code.

Attributes

Supertypes
trait Singleton
trait Product
trait Mirror
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
Self type

Base trait for custom instances of LazyMemoizer effect.

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
Supertypes
trait LazyMemoizerSignature[K, V]
trait Signature
class Object
trait Matchable
class Any
Show all
Self type

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
trait LazyMemoizerSignature[K, V] extends Signature

Signature for LazyMemoizerEffect.

Signature for LazyMemoizerEffect.

Type parameters

K

input of the memoized function

V

output of the memoized function

Attributes

Supertypes
trait Signature
class Object
trait Matchable
class Any
Known subtypes
trait LazyMemoizerEffect[K, V]
case object Maybe extends MaybeEffect

Predefined instance of MaybeEffect.

Predefined instance of MaybeEffect.

Attributes

Supertypes
trait Singleton
trait Product
trait Mirror
trait Serializable
trait Product
trait Equals
trait MaybeEffect
trait Signature
class Object
trait Matchable
class Any
Show all
Self type
Maybe.type

Base trait for custom instances of Maybe effect.

Base trait for custom instances of Maybe effect.

case object MyMaybe extends MaybeEffect
// optional:
type MyMaybe = MyMaybe.type

Attributes

See also
Companion
object
Supertypes
trait Signature
class Object
trait Matchable
class Any
Show all
Known subtypes
object Broken
object Maybe
Self type
object MaybeEffect

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
trait MaybeSignature extends Signature

Signature of MaybeEffect.

Signature of MaybeEffect.

Attributes

Supertypes
trait Signature
class Object
trait Matchable
class Any
Known subtypes
trait MaybeEffect
object Broken
object Maybe
case object Memoizer extends PolyMemoizerEffect

Predefined instance of PolyMemoizerEffect effect.

Predefined instance of PolyMemoizerEffect effect.

Note that using predefined effect instances like this, is anti-modular. However, they can be convenient in exploratory code.

Attributes

Supertypes
trait Singleton
trait Product
trait Mirror
trait Serializable
trait Product
trait Equals
class Polymorphic_-+[MemoizerEffect, Any, Any]
class Object
trait Matchable
class Any
Show all
Self type
Memoizer.type
trait MemoizerEffect[K, V] extends Effect[MemoizerSignature[K, V]], MemoizerSignature[K, V]

Base trait for custom instances of Memoizer effect.

Base trait for custom instances of Memoizer effect.

case object MyMemoizer extends MemoizerEffect[Int, String]
// optional:
type MyMemoizer = MyMemoizer.type

Memoizes a recursive, effectful function. Use the memo operation in places, where you'd normally want to invoke the function. Provide the actual function as a parameter to handler.

Type parameters

K

input of the memoized function

V

output of the memoized function

Attributes

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

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
trait MemoizerSignature[K, V] extends Signature

Signature for MemoizerEffect.

Signature for MemoizerEffect.

Type parameters

K

input of the memoized function

V

output of the memoized function

Attributes

Supertypes
trait Signature
class Object
trait Matchable
class Any
Known subtypes
trait MemoizerEffect[K, V]
abstract class PolyErrorEffect extends ErrorEffect Polymorphic_- Any

Polymorphic variant of ErrorEffect.

Polymorphic variant of ErrorEffect.

In the monomorphic variant, the E type parameter is supplied during creation of an instance of the effect:

// The `E` is explicitly set as `String`:
case object MyError extends ErrorEffect[String]

// The `E` is inferred from the effect instance:
val computation = Myerror.raise("OMG")

In the polymorphic variant, the E type parameter is contravariantly inferred at call sites of effect's operations and handlers. In practice, the type can "grow as you go":

case object MyError extends PolyErrorEffect

val computation1 = MyError.raise(42)              // `E` inferred as `Int`
val computation2 = MyError.raise("OMG")           // `E` inferred as `String`
val computation3 = computation1 &&! computation2  // `E` inferred as `Int | String`

// Inferred types of the above computations:
val _: Nothing !! MyError.@@[Int]          = computation1
val _: Nothing !! MyError.@@[String]       = computation2
val _: Nothing !! MyError.@@[Int | String] = computation3

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object Error

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
abstract class PolyLazyMemoizerEffect extends Polymorphic_-+[LazyMemoizerEffect, Any, Any]

Polymorphic variant of LazyMemoizerEffect.

Polymorphic variant of LazyMemoizerEffect.

The 'K' and 'V' parameters are inferred from the call sites of the effects's operations and handlers.

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
object LazyMemoizer
abstract class PolyMemoizerEffect extends Polymorphic_-+[MemoizerEffect, Any, Any]

Polymorphic variant of MemoizerEffect.

Polymorphic variant of MemoizerEffect.

The 'K' and 'V' parameters are inferred from the call sites of the effects's operations and handlers.

Attributes

Supertypes
class Polymorphic_-+[MemoizerEffect, Any, Any]
class Object
trait Matchable
class Any
Known subtypes
object Memoizer
abstract class PolyReaderEffect extends ReaderEffect Polymorphic_+ Any

Polymorphic variant of ReaderEffect.

Polymorphic variant of ReaderEffect.

In the monomorphic variant, the R type parameter is supplied during creation of an instance of the effect:

// The `R` is explicitly set as `String`:
case object MyReader extends ReaderEffect[String]

// The `R` is inferred from the effect instance:
val computation = MyReader.ask

In the polymorphic variant, the R type parameter is covariantly inferred at call sites of effect's operations and handlers In practice, the type can "grow as you go":

case object MyReader extends PolyReaderEffect

val computation1 = MyReader.ask[Int]              // `R` inferred as `Int`
val computation2 = MyReader.ask[String]           // `R` inferred as `String`
val computation3 = computation1 **! computation2  // `R` inferred as `Int & String`

// Inferred types of the above computations:
val _: Int           !! MyReader.@@[Int]          = computation1
val _: String        !! MyReader.@@[String]       = computation2
val _: (Int, String) !! MyReader.@@[Int & String] = computation3

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object Reader

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
abstract class PolyResourceEffect extends ResourceEffect Polymorphic_+ Any

Polymorphic variant of ResourceEffect.

Polymorphic variant of ResourceEffect.

In the monomorphic variant, the U type parameter is supplied during creation of an instance of the effect:

// `The U` is explicitly set as `IO`:
case object MyResource extends ResourceEffect[IO]

// The `U` is inferred from the effect instance:
val computation = MyResource.register(IO(println("RESOURCE CLOSED!")))

In the polymorphic variant, the U type parameter is covariantly inferred at call sites of effect's operations and handlers:

case object MyResource extends PolyResourceEffect

// auxiliary definitions, because we need 2 distinct effects:
case object S1 extends StateEffect[Boolean]; type S1 = S1.type
case object S2 extends StateEffect[Boolean]; type S2 = S2.type

val computation1 = MyResource.register(S1.put(false))  // `U` inferred as `S1`
val computation2 = MyResource.register(S2.put(false))  // `U` inferred as `S2`
val computation3 = computation1 &&! computation2       // `U` inferred as `S1 & S2`

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object Resource

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
abstract class PolyStateEffect extends StateEffect Polymorphic_= Any

Polymorphic variant of StateEffect.

Polymorphic variant of StateEffect.

In the monomorphic variant, the S type parameter is supplied during creation of an instance of the effect:

// The `S` is explicitly set as `Int`:
case object MyState extends StateEffect[Int]

// The `S` is inferred from the effect instance:
val computation = MyState.get

In the polymorphic variant, the S type parameter is invariantly inferred at call sites of effect's operations and handlers:

case object MyState extends PolyStateEffect

val computation1 = MyState.put(42)      // `S` inferred as `Int`
val computation2 = MyState.get[Int]     // `S` inferred as `Int`
val computation3 = MyState.get[String]  // `S` inferred as `String`

// Inferred types of the above computations:
val _: Unit !! MyState.@@[Int]    = computation1
val _: Unit !! MyState.@@[Int]    = computation2
val _: Unit !! MyState.@@[String] = computation3

// Type error!
// Since `S` is invariant, compiler can't unify `S` as `Int` with `S` as `String`
val computation4 = computation2 &&! computation3

User must ensure that S is inferred as the same type at all call sites, within the scope delimited by this effect's handler. Otherwise, application of the handler will fail to typecheck.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object State

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
abstract class PolyWriterEffect extends WriterEffect Polymorphic_- Any

Polymorphic variant of WriterEffect.

Polymorphic variant of WriterEffect.

In the monomorphic variant, the W type parameter is supplied during creation of an instance of the effect:

// The `W` is explicitly set as `Int`:
case object MyWriter extends WriterEffect[Int]

// The `W` is inferred from the effect instance:
val computation = MyWriter.tell(42)

In the polymorphic variant, the W type parameter is contravariantly inferred at call sites of effect's operations and handlers. In practice, the type can "grow as you go":

case object MyWriter extends PolyWriterEffect

val computation1 = MyWriter.tell(42)              // `W` inferred as `Int`
val computation2 = MyWriter.tell("OMG")           // `W` inferred as `String`
val computation3 = computation1 &&! computation2  // `W` inferred as `Int | String`

// Inferred types of the above computations:
val _: Unit !! MyWriter.@@[Int]          = computation1
val _: Unit !! MyWriter.@@[String]       = computation2
val _: Unit !! MyWriter.@@[Int | String] = computation3

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object Writer

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
case object Random extends RandomEffect

Predefined instance of this RandomEffect.

Predefined instance of this RandomEffect.

Attributes

Supertypes
trait Singleton
trait Product
trait Mirror
trait Serializable
trait Product
trait Equals
trait RandomEffect
trait Signature
class Object
trait Matchable
class Any
Show all
Self type
Random.type

Base trait for custom instances of Random effect.

Base trait for custom instances of Random effect.

case object MyRandom extends RandomEffect
// optional:
type MyRandom = MyRandom.type

Effectful version of scala.util.Random

Attributes

See also
Companion
object
Supertypes
trait Signature
class Object
trait Matchable
class Any
Show all
Known subtypes
object Random
Self type
object RandomEffect

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
trait RandomSignature extends Signature

Signature of RandomEffect.

Signature of RandomEffect.

Attributes

Supertypes
trait Signature
class Object
trait Matchable
class Any
Known subtypes
trait RandomEffect
object Random
case object Reader extends PolyReaderEffect

Predefined instance of PolyReaderEffect.

Predefined instance of PolyReaderEffect.

Note that using predefined effect instances like this, is anti-modular. However, they can be convenient in exploratory code.

Attributes

Supertypes
trait Singleton
trait Product
trait Mirror
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
Self type
Reader.type

Base trait for custom instances of Reader effect.

Base trait for custom instances of Reader effect.

case object MyReader extends ReaderEffect[Int]
// optional:
type MyReader = MyReader.type

Attributes

See also
Companion
object
Supertypes
trait ReaderSignature[R]
trait Signature
class Object
trait Matchable
class Any
Show all
Self type
object ReaderEffect

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
trait ReaderSignature[R] extends Signature

Signature of ReaderEffect.

Signature of ReaderEffect.

Attributes

Supertypes
trait Signature
class Object
trait Matchable
class Any
Known subtypes
trait ReaderEffect[R]
case object Resource extends PolyResourceEffect

Predefined instance of PolyResourceEffect.

Predefined instance of PolyResourceEffect.

Note that using predefined effect instances like this, is anti-modular. However, they can be convenient in exploratory code.

Attributes

Supertypes
trait Singleton
trait Product
trait Mirror
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
Self type
Resource.type

Base trait for custom instances of Resource effect.

Base trait for custom instances of Resource effect.

case object MyResource extends ResourceEffect[java.io.InputStream]
// optional:
type MyResource = MyResource.type

Type parameters

U

Type-level set of effects used to acquire/release the resources.

Attributes

See also
Companion
object
Supertypes
trait Signature
class Object
trait Matchable
class Any
Show all
Known subtypes
object ResourceIO
Self type

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
case object ResourceIO extends ResourceEffect[IO]

Predefined instance of ResourceEffect.

Predefined instance of ResourceEffect.

Attributes

Supertypes
trait Singleton
trait Product
trait Mirror
trait Serializable
trait Product
trait Equals
trait Signature
class Object
trait Matchable
class Any
Show all
Self type
ResourceIO.type
trait ResourceSignature[U] extends Signature

Signature of ResourceEffect.

Signature of ResourceEffect.

Type parameters

U

Type-level set of effects used to acquire/release the resources.

Attributes

Supertypes
trait Signature
class Object
trait Matchable
class Any
Known subtypes
trait ResourceEffect[U]
object ResourceIO
case object State extends PolyStateEffect

Predefined instance of PolyStateEffect.

Predefined instance of PolyStateEffect.

Note that using predefined effect instances like this, is anti-modular. However, they can be convenient in exploratory code.

Attributes

Supertypes
trait Singleton
trait Product
trait Mirror
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
Self type
State.type
trait StateEffect[S] extends Effect[StateSignature[S]], StateSignature[S]

Base trait for custom instances of State effect.

Base trait for custom instances of State effect.

case object MyState extends StateEffect[Int]
// optional:
type MyState = MyState.type

Attributes

See also
Companion
object
Supertypes
trait StateSignature[S]
trait Signature
class Object
trait Matchable
class Any
Show all
Self type
object StateEffect

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
trait StateSignature[S] extends Signature

Signature of StateEffect.

Signature of StateEffect.

Attributes

Supertypes
trait Signature
class Object
trait Matchable
class Any
Known subtypes
trait StateEffect[S]
object UnsafeIO

Some IO operations with IO effect removed from the signature.

Some IO operations with IO effect removed from the signature.

Provided because in some circumstances they may be safely considered as IO-free.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
UnsafeIO.type
case object Writer extends PolyWriterEffect

Predefined instance of PolyWriterEffect.

Predefined instance of PolyWriterEffect.

Note that using predefined effect instances like this, is anti-modular. However, they can be convenient in exploratory code.

Attributes

Supertypes
trait Singleton
trait Product
trait Mirror
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
Self type
Writer.type
trait WriterEffect[W] extends WriterEffectExt[W, W]

Specialized WriterEffectExt, where W and W1 are the same (e.g. a monoid).

Specialized WriterEffectExt, where W and W1 are the same (e.g. a monoid).

Attributes

Supertypes
trait WriterEffectExt[W, W]
trait WriterSignature[W, W]
trait Signature
trait Effect[WriterSignature[W, W]]
class Object
trait Matchable
class Any
Show all
trait WriterEffectExt[W, W1] extends Effect[WriterSignature[W, W1]], WriterSignature[W, W1]

Base trait for custom instances of Writer effect.

Base trait for custom instances of Writer effect.

case object MyWriter extends WriterEffect[Int]
// optional:
type MyWriter = MyWriter.type

Notice that WriterEffectExt takes type 2 parameters. This abstraction enables ergonomic syntax of tell(w), which relieves the user from the necessity of wrapping w in Nel (raise(Nel(w))), as in the standard Writer monad. For the simpler, single-parmeter version, see WriterEffect.

Type parameters

W

Accumulator

W1

Singular value added to the accumulator

Attributes

See also
Companion
object
Supertypes
trait WriterSignature[W, W1]
trait Signature
trait Effect[WriterSignature[W, W1]]
class Object
trait Matchable
class Any
Show all
Known subtypes
trait WriterEffect[W]
trait WriterEffectG[M, K, V]
trait WriterEffectGK[M, K, F, V]
trait WriterEffectK[F, W]
Self type

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
trait WriterEffectG[M[_, _], K, V] extends WriterEffectExt[M[K, V], (K, V)]

Specialized WriterEffectExt, where pairs (K, V) are accumulated into M[K, V] (e.g. a map).

Specialized WriterEffectExt, where pairs (K, V) are accumulated into M[K, V] (e.g. a map).

Attributes

Supertypes
trait WriterEffectExt[M[K, V], (K, V)]
trait WriterSignature[M[K, V], (K, V)]
trait Signature
trait Effect[WriterSignature[M[K, V], (K, V)]]
class Object
trait Matchable
class Any
Show all
trait WriterEffectGK[M[_, _], K, F[_], V] extends WriterEffectExt[M[K, F[V]], (K, V)]

Specialized WriterEffectExt, where pairs (K, V) are accumulated into M[K, F[V]] (e.g. a map of collections).

Specialized WriterEffectExt, where pairs (K, V) are accumulated into M[K, F[V]] (e.g. a map of collections).

Attributes

Supertypes
trait WriterEffectExt[M[K, F[V]], (K, V)]
trait WriterSignature[M[K, F[V]], (K, V)]
trait Signature
trait Effect[WriterSignature[M[K, F[V]], (K, V)]]
class Object
trait Matchable
class Any
Show all
trait WriterEffectK[F[_], W] extends WriterEffectExt[F[W], W]

Specialized WriterEffectExt, where values W are accumulated into F[W] (e.g. a collection).

Specialized WriterEffectExt, where values W are accumulated into F[W] (e.g. a collection).

Attributes

Supertypes
trait WriterEffectExt[F[W], W]
trait WriterSignature[F[W], W]
trait Signature
trait Effect[WriterSignature[F[W], W]]
class Object
trait Matchable
class Any
Show all
trait WriterSignature[W, W1] extends Signature

Signature of WriterEffectExt.

Signature of WriterEffectExt.

Type parameters

W

Accumulator

W1

Singular value added to the accumulator

Attributes

Supertypes
trait Signature
class Object
trait Matchable
class Any
Known subtypes
trait WriterEffectExt[W, W1]
trait WriterEffect[W]
trait WriterEffectG[M, K, V]
trait WriterEffectGK[M, K, F, V]
trait WriterEffectK[F, W]

Types

type Broken = Broken.type
type Choice = Choice.type
type Console = Console.type
type Each = Each.type
type Error[E] = @@[E]
type LazyMemoizer[K, V] = K @@ V
type Maybe = Maybe.type
type Memoizer[K, V] = K @@ V
type Random = Random.type
type Reader[R] = @@[R]
type Resource[U] = @@[U]
type ResourceIO = ResourceIO.type
type State[S] = @@[S]
type Writer[W] = @@[W]