turbolift.effects
Members list
Type members
Classlikes
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 useAlternative.empty
- Binary operators
+!
and++!
(similar to<+>
from Cats) useplus
andplusPar
.
Attributes
- Supertypes
-
trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalstrait ChoiceSignaturetrait Signatureclass Objecttrait Matchableclass AnyShow all
- Self type
-
Alternative.type
Predefined instance of MaybeEffect, used by io.EffectfulVar
.
Predefined instance of MaybeEffect, used by io.EffectfulVar
.
Attributes
- Supertypes
-
trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalstrait MaybeEffecttrait MaybeSignaturetrait Signaturetrait Effect[MaybeSignature]class Objecttrait Matchableclass AnyShow all
- Self type
-
Broken.type
Predefined instance of ChoiceEffect.
Predefined instance of ChoiceEffect.
Attributes
- Supertypes
-
trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalstrait ChoiceEffecttrait ChoiceSignaturetrait Signaturetrait Effect[ChoiceSignature]class Objecttrait Matchableclass AnyShow 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 ChoiceSignaturetrait Signaturetrait Effect[ChoiceSignature]class Objecttrait Matchableclass AnyShow all
- Known subtypes
- Self type
Attributes
- Companion
- trait
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
ChoiceEffect.type
Signature of ChoiceEffect.
Predefined instance of ConsoleEffect.
Predefined instance of ConsoleEffect.
Attributes
- Supertypes
-
trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalstrait ConsoleEffecttrait AnsiColortrait ConsoleSignaturetrait Signaturetrait Effect[ConsoleSignature]class Objecttrait Matchableclass AnyShow 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 AnsiColortrait ConsoleSignaturetrait Signaturetrait Effect[ConsoleSignature]class Objecttrait Matchableclass AnyShow all
- Known subtypes
-
object Console
- Self type
Attributes
- Companion
- trait
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
ConsoleEffect.type
Signature of ConsoleEffect.
Attributes
- Supertypes
- Self type
-
Cont[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
Attributes
- Companion
- trait
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
CoroutineEffect.type
Signature of CoroutineEffect.
Predefined instance of ChoiceEffect.
Predefined instance of ChoiceEffect.
Attributes
- Supertypes
-
trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalstrait ChoiceEffecttrait ChoiceSignaturetrait Signaturetrait Effect[ChoiceSignature]class Objecttrait Matchableclass AnyShow all
- Self type
-
Each.type
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 Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalsclass PolyErrorEffectclass Objecttrait Matchableclass AnyShow all
- Self type
-
Error.type
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
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
- Known subtypes
-
trait ErrorEffect[E]
- Self type
-
Attributes
- Companion
- trait
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
ErrorEffectExt.type
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
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
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
Signature of ErrorEffectExt.
Signature of ErrorEffectExt.
Type parameters
- E
-
Accumulated error
- E1
-
Singular error added to the accumulator (commonly same as E)
Attributes
- Supertypes
- Known subtypes
-
trait ErrorEffect[E]
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
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 Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalsclass PolyLazyMemoizerEffectclass Objecttrait Matchableclass AnyShow all
- Self type
-
LazyMemoizer.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
Attributes
- Companion
- trait
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
LazyMemoizerEffect.type
Signature for LazyMemoizerEffect.
Signature for LazyMemoizerEffect.
Type parameters
- K
-
input of the memoized function
- V
-
output of the memoized function
Attributes
- Supertypes
- Known subtypes
-
Predefined instance of MaybeEffect.
Predefined instance of MaybeEffect.
Attributes
- Supertypes
-
trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalstrait MaybeEffecttrait MaybeSignaturetrait Signaturetrait Effect[MaybeSignature]class Objecttrait Matchableclass AnyShow 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 MaybeSignaturetrait Signaturetrait Effect[MaybeSignature]class Objecttrait Matchableclass AnyShow all
- Known subtypes
- Self type
Attributes
- Companion
- trait
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
MaybeEffect.type
Signature of MaybeEffect.
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 Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalsclass PolyMemoizerEffectclass Objecttrait Matchableclass AnyShow all
- Self type
-
Memoizer.type
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
Attributes
- Companion
- trait
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
MemoizerEffect.type
Signature for MemoizerEffect.
Signature for MemoizerEffect.
Type parameters
- K
-
input of the memoized function
- V
-
output of the memoized function
Attributes
- Supertypes
- Known subtypes
-
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
Attributes
- Companion
- class
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
PolyErrorEffect.type
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
- Known subtypes
-
object LazyMemoizer
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
- Known subtypes
-
object Memoizer
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
Attributes
- Companion
- class
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
PolyReaderEffect.type
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
Attributes
- Companion
- class
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
PolyResourceEffect.type
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
Attributes
- Companion
- class
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
PolyStateEffect.type
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
Attributes
- Companion
- class
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
PolyWriterEffect.type
Predefined instance of this RandomEffect.
Predefined instance of this RandomEffect.
Attributes
- Supertypes
-
trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalstrait RandomEffecttrait RandomSignaturetrait Signaturetrait Effect[RandomSignature]class Objecttrait Matchableclass AnyShow 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 RandomSignaturetrait Signaturetrait Effect[RandomSignature]class Objecttrait Matchableclass AnyShow all
- Known subtypes
-
object Random
- Self type
Attributes
- Companion
- trait
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
RandomEffect.type
Signature of RandomEffect.
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 Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalsclass PolyReaderEffectclass Objecttrait Matchableclass AnyShow 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
- Self type
-
ReaderEffect[R]
Attributes
- Companion
- trait
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
ReaderEffect.type
Signature of ReaderEffect.
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 Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalsclass PolyResourceEffectclass Objecttrait Matchableclass AnyShow 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
- Known subtypes
-
object ResourceIO
- Self type
Attributes
- Companion
- trait
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
ResourceEffect.type
Predefined instance of ResourceEffect.
Predefined instance of ResourceEffect.
Attributes
- Supertypes
-
trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalstrait ResourceEffect[IO]trait ResourceSignature[IO]trait Signatureclass Objecttrait Matchableclass AnyShow all
- Self type
-
ResourceIO.type
Signature of ResourceEffect.
Signature of ResourceEffect.
Type parameters
- U
-
Type-level set of effects used to acquire/release the resources.
Attributes
- Supertypes
- Known subtypes
-
trait ResourceEffect[U]object ResourceIO
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 Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalsclass PolyStateEffectclass Objecttrait Matchableclass AnyShow all
- Self type
-
State.type
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
- Self type
-
StateEffect[S]
Attributes
- Companion
- trait
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
StateEffect.type
Signature of StateEffect.
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 Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalsclass PolyWriterEffectclass Objecttrait Matchableclass AnyShow all
- Self type
-
Writer.type
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
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
- Known subtypes
-
trait WriterEffect[W]
- Self type
-
Attributes
- Companion
- trait
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
WriterEffectExt.type
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
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
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
Signature of WriterEffectExt.
Signature of WriterEffectExt.
Type parameters
- W
-
Accumulator
- W1
-
Singular value added to the accumulator
Attributes
- Supertypes
- Known subtypes
-
trait WriterEffect[W]