Computation

turbolift.Computation$
See theComputation companion class

Use the !! alias to access methods of this companion object.

Example:

import turbolift.!!

val myComputation: Int !! Any = !!.pure(42)

Attributes

Companion:
class
Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Concise view

Value members

Concrete methods

def defer[A, U](ua: => Computation[A, U]): Computation[A, U]
def every[A, U](body: Computation[A, U & Each]): Computation[Vector[A], U]

Handles Each effect.

Handles Each effect.

Attributes

def everyVoid[A, U](body: Computation[Unit, U & Each]): Computation[Unit, U]

Handles Each effect, discarding the result.

Handles Each effect, discarding the result.

Attributes

def fail: Computation[Nothing, ChoiceSig]

Executes fail operation from the innermost Choice effect in the current scope.

Executes fail operation from the innermost Choice effect in the current scope.

Attributes

def generate[A, B, U](init: A, cond: A => Boolean, inc: A => A)(body: A => Computation[B, U]): Computation[Vector[B], U]

Like iterate, but returns results of each iteration.

Like iterate, but returns results of each iteration.

Attributes

def impure[A](a: => A): Computation[A, Any]
def isParallel: Computation[Boolean, Any]
def isSequential: Computation[Boolean, Any]
def iterate[A, U](init: A, cond: A => Boolean, inc: A => A)(body: A => Computation[Unit, U]): Computation[A, U]

Like the standard for loop, but using computation instead of statement.

Like the standard for loop, but using computation instead of statement.

Returns last value of the iterated variable.

Attributes

def iterateUntil[A, U](init: A, cond: A => Boolean)(body: A => Computation[A, U]): Computation[A, U]

Like the standard for loop, but using computation instead of statement.

Like the standard for loop, but using computation instead of statement.

Returns last value of the iterated variable.

Attributes

def iterateWhile[A, U](init: A, cond: A => Boolean)(body: A => Computation[A, U]): Computation[A, U]

Like the standard for loop, but using computation instead of statement.

Like the standard for loop, but using computation instead of statement.

Returns last value of the iterated variable.

Attributes

def parallelly[A, U](body: Computation[A, U]): Computation[A, U]
def parallellyIf[A, U](cond: Boolean)(body: Computation[A, U]): Computation[A, U]
def pure[A](a: A): Computation[A, Any]
def repeat[U](n: Int)(body: => Computation[Unit, U]): Computation[Unit, U]

Repeats the computation, given number of times.

Repeats the computation, given number of times.

Attributes

def repeatUntil[U, U2 <: U](cond: Computation[Boolean, U])(body: => Computation[Unit, U2]): Computation[Unit, U2]

Repeats the computation, while the effectful condition is false.

Repeats the computation, while the effectful condition is false.

Attributes

def repeatWhile[U, U2 <: U](cond: Computation[Boolean, U])(body: => Computation[Unit, U2]): Computation[Unit, U2]

Repeats the computation, while the effectful condition is true.

Repeats the computation, while the effectful condition is true.

Attributes

def replicate[A, U](n: Int)(body: => Computation[A, U]): Computation[Vector[A], U]

Like repeat, but returns results of each iteration.

Like repeat, but returns results of each iteration.

Attributes

def sequentially[A, U](body: Computation[A, U]): Computation[A, U]
def sequentiallyIf[A, U](cond: Boolean)(body: Computation[A, U]): Computation[A, U]
def when[U](cond: Boolean)(body: => Computation[Unit, U]): Computation[Unit, U]

Executes the computation, if the condition is true.

Executes the computation, if the condition is true.

Attributes

Concrete fields

val unit: Computation[Unit, Any]

Same as !!.pure(()).

Same as !!.pure(()).

Attributes

Extensions

Inherited extensions

extension [U](thiz: Computation[Boolean, U])
def if_!![U2 <: U](thenBody: => Computation[Unit, U2])(elseBody: => Computation[Unit, U2]): Computation[Unit, U2]

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 until_!![U2 <: U](body: => Computation[Unit, U2]): Computation[Unit, U2]

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]

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)
extension [F[_], L, N](thiz: Computation[Handler[F, L, N], N])
def flattenHandler: Handler[F, L, N]

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)
extension [A](thiz: Computation[A, Any])
def run(using config: LauncherConfig): A

Runs the computation, provided that it requests no effects.

Runs the computation, provided that it requests no effects.

Attributes

Inherited from:
ComputationExtensions (hidden)
extension [A, U >: IO](thiz: Computation[A, U])
def unsafeRun(using config: LauncherConfig): Try[A]

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)
extension [A, B, U](thiz: Computation[(A, B), U])
def flatMap2[C, U2 <: U](f: (A, B) => Computation[C, U2]): Computation[C, U2]

Attributes

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

Attributes

Inherited from:
ComputationExtensions (hidden)
extension [A, U](thiz: Computation[A, U])
def >>=![F[_], L, N](f: A => Handler[F, L, N]): Handler[F, L, U & N]

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]

Attributes

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

Applies a handler to this computation.

Applies a handler to this computation.

Same as myHandler.handle(this).

Attributes

Inherited from:
ComputationExtensions (hidden)