Computation

turbolift.Computation
See theComputation companion object
sealed abstract class Computation[+A, -U]

Monad parametrized by a set of requested effect. Use the !! infix type alias instead.

Type-level set of effects is modelled with intersection types. Type Any means empty set.

type MyComputationType1 = String !! (MyState & MyError)
type MyComputationType2 = String !! Any

Attributes

A

Result of the computation

U

Type-level set of effects requested by this computation.

Companion:
object
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Concise view

Value members

Concrete methods

final def &![B, U2 <: U](that: Computation[B, U2]): Computation[B, U2]

Composes 2 independent computations parallelly (if possible), discarding result of the first.

Composes 2 independent computations parallelly (if possible), discarding result of the first.

Parallelism may be impossible, due to at least of one of handlers in current scope being inherently sequential (e.g. some predefined handlers for State or Error). In such case, &! behaves like &&!.

Attributes

final def &&![B, U2 <: U](that: => Computation[B, U2]): Computation[B, U2]

Composes 2 independent computations sequentially, discarding result of the first.

Composes 2 independent computations sequentially, discarding result of the first.

Attributes

final def &&<![B, U2 <: U](that: => Computation[B, U2]): Computation[A, U2]

Composes 2 independent computations sequentially, discarding result of the second.

Composes 2 independent computations sequentially, discarding result of the second.

Attributes

final def &<![B, U2 <: U](that: Computation[B, U2]): Computation[A, U2]

Composes 2 independent computations parallelly (if possible), discarding result of the second.

Composes 2 independent computations parallelly (if possible), discarding result of the second.

Parallelism may be impossible, due to at least of one of handlers in current scope being inherently sequential (e.g. some predefined handlers for State or Error). In such case, &<! behaves like &&<!.

Attributes

final def *![B, U2 <: U](that: Computation[B, U2]): Computation[(A, B), U2]

Alias for zipPar.

Alias for zipPar.

Attributes

final def **![B, U2 <: U](that: => Computation[B, U2]): Computation[(A, B), U2]

Alias for zip.

Alias for zip.

Attributes

final def ++![A2 >: A, U2 <: U & ChoiceSig](that: => Computation[A2, U2]): Computation[A2, U2]

Applies plus operation from the innermost Choice effect in the current scope.

Applies plus operation from the innermost Choice effect in the current scope.

Similar to <|> operator of Alternative.

Attributes

final def >>=[B, U2 <: U](f: A => Computation[B, U2]): Computation[B, U2]

Alias for flatMap.

Alias for flatMap.

Attributes

final def as[B](value: B): Computation[B, U]

Discards the result, and replaces it by given pure value.

Discards the result, and replaces it by given pure value.

Attributes

final def flatMap[B, U2 <: U](f: A => Computation[B, U2]): Computation[B, U2]
final def flatTap[B, U2 <: U](f: A => Computation[B, U2]): Computation[A, U2]
final def flatten[B, U2 <: U](implicit ev: A <:< Computation[B, U2]): Computation[B, U2]
final def map[B](f: A => B): Computation[B, U]
final override def toString: String

Returns a string representation of the object.

Returns a string representation of the object.

The default representation is platform dependent.

Attributes

Returns:

a string representation of the object.

Definition Classes
Any
final def upCast[U2 <: U]: Computation[A, U2]

Widens the set of requested effects.

Widens the set of requested effects.

Attributes

final def void: Computation[Unit, U]

Discards the result, and replaces it by Unit.

Discards the result, and replaces it by Unit.

Attributes

final def withFilter[U2 <: U & ChoiceSig](f: A => Boolean): Computation[A, U2]

Applies filter, using fail operation from the innermost Choice effect in the current scope.

Applies filter, using fail operation from the innermost Choice effect in the current scope.

Attributes

final def zip[B, U2 <: U](that: => Computation[B, U2]): Computation[(A, B), U2]

Composes 2 independent computations sequentially

Composes 2 independent computations sequentially

Attributes

final def zipPar[B, U2 <: U](that: Computation[B, U2]): Computation[(A, B), U2]

Composes 2 independent computations parallelly (if possible).

Composes 2 independent computations parallelly (if possible).

Parallelism may be impossible, due to at least of one of handlers in current scope being inherently sequential (e.g. some predefined handlers for State or Error). In such case, zipPar behaves like zip.

Attributes

final def zipWith[B, C, U2 <: U](that: => Computation[B, U2])(f: (A, B) => C): Computation[C, U2]

Like zip, but followed by untupled map.

Like zip, but followed by untupled map.

Attributes

final def zipWithPar[B, C, U2 <: U](that: Computation[B, U2])(f: (A, B) => C): Computation[C, U2]

Like zipPar, but followed by untupled map.

Like zipPar, but followed by untupled map.

Attributes

Inherited methods

def >>=![F[_], L, N](f: A => Handler[F, L, N]): Handler[F, L, U & N]
Extension method from Computation

Simplifies effectful creation of handlers (handlers that depend on other effects).

Simplifies effectful creation of handlers (handlers that depend on other effects).

Passes computed value to handler constructor. Effect used to compute the value, are absorbed as handler's dependencies.

Attributes

Inherited from:
ComputationExtensions (hidden)
def downCast[U2 >: U]: Computation[A, U2]
Extension method from Computation

Attributes

Inherited from:
ComputationExtensions (hidden)
def flatMap2[C, U2 <: U](f: (A, B) => Computation[C, U2]): Computation[C, U2]
Extension method from Computation

Attributes

Inherited from:
ComputationExtensions (hidden)
def flattenHandler: Handler[F, L, N]
Extension method from Computation

Simplifies effectful creation of handlers (handlers that depend on other effects).

Simplifies effectful creation of handlers (handlers that depend on other effects).

Same as Handler.flatHandle(this).

Attributes

Inherited from:
ComputationExtensions (hidden)
def handleWith[V]: HandleWithApply[A, U, V]
Extension method from Computation

Applies a handler to this computation.

Applies a handler to this computation.

Same as myHandler.handle(this).

Attributes

Inherited from:
ComputationExtensions (hidden)
def if_!![U2 <: U](thenBody: => Computation[Unit, U2])(elseBody: => Computation[Unit, U2]): Computation[Unit, U2]
Extension method from Computation

Like if statement, but the condition and the body are computations.

Like if statement, but the condition and the body are computations.

Attributes

Inherited from:
ComputationExtensions (hidden)
def map2[C](f: (A, B) => C): Computation[C, U]
Extension method from Computation

Attributes

Inherited from:
ComputationExtensions (hidden)
def run(using config: LauncherConfig): A
Extension method from Computation

Runs the computation, provided that it requests no effects.

Runs the computation, provided that it requests no effects.

Attributes

Inherited from:
ComputationExtensions (hidden)
def unsafeRun(using config: LauncherConfig): Try[A]
Extension method from Computation

Runs the computation, provided that it requests IO effect only, or none at all.

Runs the computation, provided that it requests IO effect only, or none at all.

Attributes

Inherited from:
ComputationExtensions (hidden)
def until_!![U2 <: U](body: => Computation[Unit, U2]): Computation[Unit, U2]
Extension method from Computation

Like while statement, but the condition and the body are computations.

Like while statement, but the condition and the body are computations.

Attributes

Inherited from:
ComputationExtensions (hidden)
def while_!![U2 <: U](body: => Computation[Unit, U2]): Computation[Unit, U2]
Extension method from Computation

Like while statement, but the condition and the body are computations.

Like while statement, but the condition and the body are computations.

Attributes

Inherited from:
ComputationExtensions (hidden)