object Process extends ProcessInstances
- Source
- Process.scala
- Alphabetic
- By Inheritance
- Process
- ProcessInstances
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
-
case class
Append
[+F[_], +O](head: HaltEmitOrAwait[F, O], stack: Vector[(Cause) ⇒ Trampoline[Process[F, O]]]) extends Process[F, O] with Product with Serializable
The
Appendconstructor instructs the driver to continue with evaluation of first step found in tail Vector.The
Appendconstructor instructs the driver to continue with evaluation of first step found in tail Vector.Instead of this constructor please use:
Process.append
-
case class
Await
[+F[_], A, +O](req: F[A], rcv: (\/[EarlyCause, A]) ⇒ Trampoline[Process[F, O]], preempt: (A) ⇒ Trampoline[Process[F, Nothing]] = ...) extends HaltEmitOrAwait[F, O] with EmitOrAwait[F, O] with Product with Serializable
The
Awaitconstructor instructs the driver to evaluatereq.The
Awaitconstructor instructs the driver to evaluatereq. If it returns successfully,recvis called with result on right side to transition to the next state.In case the req terminates with failure the
Error(failure)is passed on left side giving chance for any fallback action.In case the process was killed before the request is evaluated
Killis passed on left side.Killis passed on left side as well as when the request is already in progress, but process was killed.The
preemptparameter is used when constructing resource and preemption safe cleanups. SeeProcess.bracketfor more.Note that
Instead of this constructor directly, please use:
Process.await or Process.bracket
-
case class
Cont
[+F[_], +O](stack: Vector[(Cause) ⇒ Trampoline[Process[F, O]]]) extends Product with Serializable
Continuation of the process.
Continuation of the process. Represents process _stack_. Used in conjunction with
Step. -
case class
Emit
[+O](seq: Seq[O]) extends HaltEmitOrAwait[Nothing, O] with EmitOrAwait[Nothing, O] with Product with Serializable
The
Emitconstructor instructs the driver to emit the given sequence of values to the output and then halt execution with supplied reason.The
Emitconstructor instructs the driver to emit the given sequence of values to the output and then halt execution with supplied reason.Instead calling this constructor directly, please use one of the following helpers:
Process.emit Process.emitAll
-
sealed
trait
EmitOrAwait
[+F[_], +O] extends Process[F, O]
Marker trait representing process in Emit or Await state.
Marker trait representing process in Emit or Await state. Is useful for more type safety.
- case class Env [-I, -I2]() extends Product with Serializable
-
implicit final
class
EvalProcess
[F[_], O] extends AnyVal
Provides infix syntax for
eval: Process[F,F[O]] => Process[F,O] -
case class
Halt
(cause: Cause) extends HaltEmitOrAwait[Nothing, Nothing] with HaltOrStep[Nothing, Nothing] with Product with Serializable
The
Haltconstructor instructs the driver that the last evaluation of Process completed with supplied cause. -
sealed
trait
HaltEmitOrAwait
[+F[_], +O] extends Process[F, O]
Tags a state of process that has no appended tail, tha means can be Halt, Emit or Await
-
sealed
trait
HaltOrStep
[+F[_], +O] extends AnyRef
Marker trait representing next step of process or terminated process in
Halt -
implicit final
class
Process0Syntax
[O] extends AnyVal
This class provides infix syntax specific to
Process0. - implicit final class ProcessSyntax [F[_], O] extends AnyVal
-
implicit
class
SourceSyntax
[O] extends WyeOps[O]
Syntax for processes that have its effects wrapped in Task
-
case class
Step
[+F[_], +O](head: EmitOrAwait[F, O], next: Cont[F, O]) extends HaltOrStep[F, O] with Product with Serializable
Intermediate step of process.
Intermediate step of process. Used to step within the process to define complex combinators.
- type Trampoline[+A] = Free[Function0, A]
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def Both[I, I2]: Y[ReceiveY[I, I2]]
- def Get[I]: Is[I]
- def L[I]: Is[I]
- def R[I2]: T[I2]
- val Trampoline: scalaz.Trampoline.type
-
def
apply[O](o: O*): Process0[O]
Alias for emitAll
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
await[F[_], A, O](req: F[A])(rcv: (A) ⇒ Process[F, O]): Process[F, O]
Await the given
Frequest and use its result.Await the given
Frequest and use its result. If you need to specify fallback, useawaitOr -
def
await1[I]: Process1[I, I]
The
Process1which awaits a single input, emits it, then halts normally. -
def
await1Or[I](fb: ⇒ Process1[I, I]): Process1[I, I]
Like
await1, but consultsfbwhen await fails to receive anI -
def
await1W[A]: Writer1[Nothing, A, A]
Writerbased version ofawait1. -
def
awaitBoth[I, I2]: Wye[I, I2, ReceiveY[I, I2]]
The
Wyewhich request from both branches concurrently. -
def
awaitBothW[I, I2]: WyeW[Nothing, I, I2, ReceiveY[I, I2]]
Writerbased version ofawaitBoth. -
def
awaitL[I]: Tee[I, Any, I]
The
Teewhich requests from the left branch, emits this value, then halts. -
def
awaitLW[I]: TeeW[Nothing, I, Any, I]
Writerbased version ofawaitL. -
def
awaitOr[F[_], A, O](req: F[A])(fb: (EarlyCause) ⇒ Process[F, O])(rcv: (A) ⇒ Process[F, O]): Process[F, O]
Await a request, and if it fails, use
fbto determine the next state.Await a request, and if it fails, use
fbto determine the next state. Otherwise, usercvto determine the next state. -
def
awaitR[I2]: Tee[Any, I2, I2]
The
Teewhich requests from the right branch, emits this value, then halts. -
def
awaitRW[I2]: TeeW[Nothing, Any, I2, I2]
Writerbased version ofawaitR. -
def
bracket[F[_], A, O](req: F[A])(release: (A) ⇒ Process[F, Nothing])(rcv: (A) ⇒ Process[F, O]): Process[F, O]
Resource and preemption safe
awaitconstructor.Resource and preemption safe
awaitconstructor.Use this combinator, when acquiring resources. This build a process that when run evaluates
req, and then runsrcv. Oncercvis completed, fails, or is interrupted, it will runreleaseWhen the acquisition (
req) is interrupted, neitherreleaseorrcvis run, however when the req was interrupted after resource inreqwas acquired then, thereleaseis run.If,the acquisition fails, use
bracket(req)(onPreempt)(rcv).onFailure(err => ???)code to recover from the failure eventually. -
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
def
constant[A](a: A, chunkSize: Int = 1): Process0[A]
The infinite
Process, always emitsa.The infinite
Process, always emitsa. If for performance reasons it is good to emitain chunks, specify size of chunk bychunkSizeparameter -
def
emit[O](o: O): Process0[O]
The
Processwhich emits the single value given, then halts. -
def
emitAll[O](os: Seq[O]): Process0[O]
The
Processwhich emits the given sequence of values, then halts. -
def
emitO[O](o: O): Process0[\/[Nothing, O]]
A
Writerwhich emits one value to the output. -
def
emitW[W](s: W): Process0[\/[W, Nothing]]
A
Writerwhich writes the given value. -
def
empty[F[_], O]: Process[F, O]
Alias for
halt. -
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
eval[F[_], O](fo: F[O]): Process[F, O]
Alias for await(fo)(emit)
-
def
eval_[F[_], O](f: F[O]): Process[F, Nothing]
Evaluate an arbitrary effect once, purely for its effects, ignoring its return value.
Evaluate an arbitrary effect once, purely for its effects, ignoring its return value. This
Processemits no values. -
def
fail(rsn: Throwable): Process0[Nothing]
The
Processwhich emits no values and halts immediately with the given exception. -
def
fill[A](n: Int)(a: A, chunkSize: Int = 1): Process0[A]
A
Processwhich emitsnrepetitions ofa. -
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
def
forwardFill[A](p: Process[Task, A])(implicit S: Strategy): Process[Task, A]
Produce a continuous stream from a discrete stream by using the most recent value.
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
-
val
halt: Process0[Nothing]
The
Processwhich emits no values and signals normal termination. -
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
iterate[A](start: A)(f: (A) ⇒ A): Process0[A]
An infinite
Processthat repeatedly applies a given function to a start value.An infinite
Processthat repeatedly applies a given function to a start value.startis the first value emitted, followed byf(start), thenf(f(start)), and so on. -
def
iterateEval[F[_], A](start: A)(f: (A) ⇒ F[A]): Process[F, A]
Like iterate, but takes an effectful function for producing the next state.
Like iterate, but takes an effectful function for producing the next state.
startis the first value emitted. -
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
-
implicit
val
process1Choice: Choice[Process1]
- Definition Classes
- ProcessInstances
-
implicit
def
process1Contravariant[O]: Contravariant[[α]Process[Is, O]]
- Definition Classes
- ProcessInstances
-
implicit
val
process1Profunctor: Profunctor[Process1]
- Definition Classes
- ProcessInstances
-
implicit
val
processHoist: Hoist[Process]
- Definition Classes
- ProcessInstances
-
implicit
def
processMonadPlus[F[_]]: MonadPlus[[α]Process[F, α]]
- Definition Classes
- ProcessInstances
-
def
range(start: Int, stopExclusive: Int, by: Int = 1): Process0[Int]
Lazily produce the range
[start, stopExclusive).Lazily produce the range
[start, stopExclusive). If you want to produce the sequence in one chunk, instead of lazily, useemitAll(start until stopExclusive). -
def
ranges(start: Int, stopExclusive: Int, size: Int): Process0[(Int, Int)]
Lazily produce a sequence of nonoverlapping ranges, where each range contains
sizeintegers, assuming the upper bound is exclusive.Lazily produce a sequence of nonoverlapping ranges, where each range contains
sizeintegers, assuming the upper bound is exclusive. Example:ranges(0, 1000, 10)results in the pairs(0, 10), (10, 20), (20, 30) ... (990, 1000)Note: The last emitted range may be truncated at
stopExclusive. For instance,ranges(0,5,4)results in(0,4), (4,5).- Exceptions thrown
IllegalArgumentExceptionifsize<= 0
-
def
receive1[I, O](rcv: (I) ⇒ Process1[I, O]): Process1[I, O]
The
Process1which awaits a single input and passes it torcvto determine the next state. -
def
receive1Or[I, O](fb: ⇒ Process1[I, O])(rcv: (I) ⇒ Process1[I, O]): Process1[I, O]
Like
receive1, but consultsfbwhen it fails to receive an input. -
def
repeat[F[_], O](p: Process[F, O]): Process[F, O]
Prefix syntax for
p.repeat. -
def
repeatEval[F[_], O](fo: F[O]): Process[F, O]
Evaluate an arbitrary effect in a
Process.Evaluate an arbitrary effect in a
Process. The resultingProcesswill emit values until an error occurs. -
def
sleepUntil[F[_], A](awaken: Process[F, Boolean])(p: Process[F, A]): Process[F, A]
Delay running
puntilawakenbecomes true for the first time.Delay running
puntilawakenbecomes true for the first time. Theawakenprocess may be discrete. -
def
supply(initial: Long): Process[Task, Long]
A supply of
Longvalues, starting withinitial.A supply of
Longvalues, starting withinitial. Each read is guaranteed to return a value which is unique across all threads reading from thissupply. -
def
suspend[F[_], O](p: ⇒ Process[F, O]): Process[F, O]
Produce
plazily.Produce
plazily. Useful if producing the process involves allocation of some local mutable resource we want to ensure is freshly allocated for each consumer ofp.Note that this implementation assures that:
suspend(p).kill === suspend(p.kill) suspend(p).kill === p.kill suspend(p).repeat === suspend(p.repeat) suspend(p).repeat === p.repeat suspend(p).eval === suspend(p.eval) suspend(p).eval === p.eval Halt(cause) ++ suspend(p) === Halt(cause) ++ p
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
tell[S](s: S): Process0[\/[S, Nothing]]
A
Writerwhich writes the given value; alias foremitW. -
implicit
def
toChannelSyntax[F[_], I, O](self: Channel[F, I, O]): ChannelSyntax[F, I, O]
Adds syntax for
Channel. -
implicit
def
toProcess1Syntax[I, O](self: Process1[I, O]): Process1Syntax[I, O]
Adds syntax for
Process1. -
implicit
def
toSinkSyntax[F[_], I](self: Sink[F, I]): SinkSyntax[F, I]
Adds syntax for
Sink. -
implicit
def
toSinkTaskSyntax[F[_], I](self: Sink[Task, I]): SinkTaskSyntax[I]
Adds syntax for
Sinkthat is specialized for Task. -
def
toString(): String
- Definition Classes
- AnyRef → Any
-
implicit
def
toTeeSyntax[I, I2, O](self: Tee[I, I2, O]): TeeSyntax[I, I2, O]
Adds syntax for
Tee. -
implicit
def
toWriterSyntax[F[_], W, O](self: Writer[F, W, O]): WriterSyntax[F, W, O]
Adds syntax for
Writer. -
implicit
def
toWriterTaskSyntax[W, O](self: Writer[Task, W, O]): WriterTaskSyntax[W, O]
Adds syntax for
Writerthat is specialized for Task. -
implicit
def
toWyeSyntax[I, I2, O](self: Wye[I, I2, O]): WyeSyntax[I, I2, O]
Adds syntax for
Wye. -
def
unfold[S, A](s0: S)(f: (S) ⇒ Option[(A, S)]): Process0[A]
Produce a (potentially infinite) source from an unfold.
-
def
unfoldEval[F[_], S, A](s0: S)(f: (S) ⇒ F[Option[(A, S)]]): Process[F, A]
Like unfold, but takes an effectful function.
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
- object Cont extends Serializable
- object HaltEmitOrAwait