scalaz.stream

Process

sealed abstract class Process[+F[_], +O] extends AnyRef

A Process[F,O] represents a stream of O values which can interleave external requests to evaluate expressions of the form F[A]. It takes the form of a state machine with three possible states: Emit, which indicates that h should be emitted to the output stream, Halt, which indicates that the Process is finished making requests and emitting values to the output stream, and Await which asks the driver to evaluate some F[A] and resume processing once the result is available. See the constructor definitions in the Process companion object.

Linear Supertypes
AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Process
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Process()

Value Members

  1. final def !=(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. final def ++[F2[x] >: F[x], O2 >: O](p2: ⇒ Process[F2, O2]): Process[F2, O2]

    Operator alias for append.

  5. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  6. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  7. final def append[F2[x] >: F[x], O2 >: O](p2: ⇒ Process[F2, O2]): Process[F2, O2]

    Run this Process, then, if it halts without an error, run p2.

    Run this Process, then, if it halts without an error, run p2. Note that p2 is appended to the fallback argument of any Await produced by this Process. If this is not desired, use fby.

  8. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  9. def attempt[F2[x] >: F[x], O2](f: (Throwable) ⇒ Process[F2, O2] = (t:Throwable) => emit(t))(implicit F: Catchable[F2]): Process[F2, \/[O2, O]]

    Catch exceptions produced by this Process, not including normal termination, and uses f to decide whether to resume a second process.

  10. def buffer(n: Int): Process[F, O]

    Alias for this |> process1.buffer(n).

  11. def bufferAll: Process[F, O]

    Alias for this |> process1.bufferAll.

  12. def bufferBy(f: (O) ⇒ Boolean): Process[F, O]

    Alias for this |> process1.bufferBy(f).

  13. final def causedBy[F2[x] >: F[x], O2 >: O](e: Throwable): Process[F2, O2]

    Add e as a cause when this Process halts.

    Add e as a cause when this Process halts. This is a noop and returns immediately if e is Process.End.

  14. def chunk(n: Int): Process[F, Vector[O]]

    Alias for this |> process1.chunk(n).

  15. def chunkAll: Process[F, Vector[O]]

    Alias for this |> process1.chunkAll.

  16. def chunkBy(f: (O) ⇒ Boolean): Process[F, Vector[O]]

    Alias for this |> process1.chunkBy(f).

  17. final def cleanup: Process[F, O]

    Switch to the cleanup case of the next Await issued by this Process.

  18. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  19. def collect[O2](pf: PartialFunction[O, O2]): Process[F, O2]

    Alias for this |> process1.collect(pf).

  20. final def disconnect: Process[Nothing, O]

    Switch to the fallback case of _all_ subsequent awaits.

  21. def drain: Process[F, Nothing]

    Ignores output of this Process.

    Ignores output of this Process. A drained Process will never Emit.

  22. def drop(n: Int): Process[F, O]

    Ignores the first n elements output from this Process.

  23. def dropWhile(f: (O) ⇒ Boolean): Process[F, O]

    Ignores elements from the output of this Process until f tests false.

  24. def either[F2[x] >: F[x], O2 >: O, O3](p2: Process[F2, O3])(implicit F: Nondeterminism[F2], E: Catchable[F2]): Process[F2, \/[O2, O3]]

    Nondeterministic interleave of both streams.

    Nondeterministic interleave of both streams. Emits values whenever either is defined.

  25. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  26. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  27. def evalMap[F2[x] >: F[x], O2](f: (O) ⇒ F2[O2]): Process[F2, O2]

    Map over this Process to produce a stream of F-actions, then evaluate these actions.

  28. final def fallback: Process[F, O]

    Switch to the fallback case of the _next_ Await issued by this Process.

  29. final def fby[F2[x] >: F[x], O2 >: O](p2: ⇒ Process[F2, O2]): Process[F2, O2]

    Run this Process, then, if it self-terminates, run p2.

    Run this Process, then, if it self-terminates, run p2. This differs from append in that p2 is not consulted if this Process terminates due to the input being exhausted. That is, we do not modify the fallback arguments to any Await produced by this Process.

  30. def filter(f: (O) ⇒ Boolean): Process[F, O]

    Skips any output elements not matching the predicate.

  31. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  32. def find(f: (O) ⇒ Boolean): Process[F, O]

    Alias for this |> process1.find(f)

  33. final def flatMap[F2[x] >: F[x], O2](f: (O) ⇒ Process[F2, O2]): Process[F2, O2]

    Generate a Process dynamically for each output of this Process, and sequence these processes using append.

  34. def flush[F2[x] >: F[x], O2 >: O]: Seq[O2]

    Return any elements emitted by this process after switching to the fallback case of any subsequent Awaits.

  35. def fold[O2 >: O](b: O2)(f: (O2, O2) ⇒ O2): Process[F, O2]

    Connect this Process to process1.fold(b)(f).

  36. def fold1[O2 >: O](f: (O2, O2) ⇒ O2): Process[F, O2]

    Connect this Process to process1.fold1(f).

  37. def fold1Map[M](f: (O) ⇒ M)(implicit M: Monoid[M]): Process[F, M]

    Alias for this |> process1.fold1Map(f)(M).

  38. def fold1Monoid[O2 >: O](implicit M: Monoid[O2]): Process[F, O2]

    Alias for this |> process1.fold1Monoid(M)

  39. def foldMap[M](f: (O) ⇒ M)(implicit M: Monoid[M]): Process[F, M]

    Alias for this |> process1.foldMap(f)(M).

  40. def foldMonoid[O2 >: O](implicit M: Monoid[O2]): Process[F, O2]

    Alias for this |> process1.foldMonoid(M)

  41. def foldSemigroup[O2 >: O](implicit M: Semigroup[O2]): Process[F, O2]

    Alias for this |> process1.fold1Semigroup(M).

  42. def gatherMap[F2[x] >: F[x], O2](bufSize: Int)(f: (O) ⇒ F2[O2])(implicit F: Nondeterminism[F2]): Process[F2, O2]

    Map over this Process to produce a stream of F-actions, then evaluate these actions, returning results in whatever order they come back.

    Map over this Process to produce a stream of F-actions, then evaluate these actions, returning results in whatever order they come back. bufSize controls the maximum number of evaluations that can be queued at any one time.

  43. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  44. def handle[F2[x] >: F[x], O2](f: PartialFunction[Throwable, Process[F2, O2]])(implicit F: Catchable[F2]): Process[F2, O2]

    Catch some of the exceptions generated by this Process, rethrowing any not handled by the given PartialFunction and stripping out any values emitted before the error.

  45. final def hardDisconnect: Process[Nothing, O]

    Switch to the cleanup case of _all_ subsequent awaits.

  46. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  47. def interleave[F2[x] >: F[x], O2 >: O](p2: Process[F2, O2]): Process[F2, O2]

    Alternate emitting elements from this and p2, starting with this.

  48. def intersperse[O2 >: O](sep: O2): Process[F, O2]

    Insert sep between elements emitted by this Process.

  49. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  50. final def kill: Process[F, Nothing]

    Halt this process, but give it an opportunity to run any requests it has in the cleanup argument of its next Await.

    Halt this process, but give it an opportunity to run any requests it has in the cleanup argument of its next Await.

    Annotations
    @tailrec()
  51. final def killBy(e: Throwable): Process[F, Nothing]

    Halt this process, allowing for any cleanup actions, and e as a cause.

  52. def last: Process[F, O]

    Skips all elements emitted by this Process except the last.

  53. final def map[O2](f: (O) ⇒ O2): Process[F, O2]

    Transforms the output values of this Process using f.

  54. def merge[F2[x] >: F[x], O2 >: O](p2: Process[F2, O2])(implicit F: Nondeterminism[F2], E: Catchable[F2]): Process[F2, O2]

    Nondeterministic interleave of both streams.

    Nondeterministic interleave of both streams. Emits values whenever either is defined.

  55. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  56. final def notify(): Unit

    Definition Classes
    AnyRef
  57. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  58. final def onComplete[F2[x] >: F[x], O2 >: O](p2: ⇒ Process[F2, O2]): Process[F2, O2]

    Run p2 after this Process completes normally, or in the event of an error.

    Run p2 after this Process completes normally, or in the event of an error. This behaves almost identically to append, except that p1 append p2 will not run p2 if p1 halts with an error.

  59. final def onFailure[F2[x] >: F[x], O2 >: O](p2: ⇒ Process[F2, O2]): Process[F2, O2]

    Run p2 after this Process if this Process completes with an an error.

  60. def once: Process[F, O]

    Halts this Process after emitting 1 element.

  61. final def orElse[F2[x] >: F[x], O2 >: O](fallback0: ⇒ Process[F2, O2], cleanup0: ⇒ Process[F2, O2] = halt): Process[F2, O2]

    Append to the fallback and cleanup arguments of the _next_ Await.

  62. def partialAttempt[F2[x] >: F[x], O2](f: PartialFunction[Throwable, Process[F2, O2]])(implicit F: Catchable[F2]): Process[F2, \/[O2, O]]

    Like attempt, but accepts a partial function.

    Like attempt, but accepts a partial function. Unhandled errors are rethrown.

  63. final def pipe[O2](p2: Process.Process1[O, O2]): Process[F, O2]

    Feed the output of this Process as input of p2.

    Feed the output of this Process as input of p2. The implementation will fuse the two processes, so this process will only generate values as they are demanded by p2. If p2 signals termination, this is killed using kill, giving it the opportunity to clean up.

  64. def reduce[O2 >: O](f: (O2, O2) ⇒ O2): Process[F, O2]

    Alias for this |> process1.reduce(f).

  65. def reduceMap[M](f: (O) ⇒ M)(implicit M: Monoid[M]): Process[F, M]

    Alias for this |> process1.reduceMap(f)(M).

  66. def reduceMonoid[O2 >: O](implicit M: Monoid[O2]): Process[F, O2]

    Alias for this |> process1.reduceMonoid(M).

  67. def reduceSemigroup[O2 >: O](implicit M: Semigroup[O2]): Process[F, O2]

    Alias for this |> process1.reduceSemigroup(M).

  68. final def repeat[F2[x] >: F[x], O2 >: O]: Process[F2, O2]

    Run this process until it halts, then run it again and again, as long as no errors occur.

  69. final def run[F2[x] >: F[x]](implicit F: Monad[F2], C: Catchable[F2]): F2[Unit]

    Run this Process, purely for its effects.

  70. final def runFoldMap[F2[x] >: F[x], B](f: (O) ⇒ B)(implicit F: Monad[F2], C: Catchable[F2], B: Monoid[B]): F2[B]

    Collect the outputs of this Process[F,O] into a monoid B, given a Monad[F] in which we can catch exceptions.

    Collect the outputs of this Process[F,O] into a monoid B, given a Monad[F] in which we can catch exceptions. This function is not tail recursive and relies on the Monad[F] to ensure stack safety.

  71. final def runLast[F2[x] >: F[x], O2 >: O](implicit F: Monad[F2], C: Catchable[F2]): F2[Option[O2]]

    Run this Process solely for its final emitted value, if one exists.

  72. final def runLastOr[F2[x] >: F[x], O2 >: O](o2: ⇒ O2)(implicit F: Monad[F2], C: Catchable[F2]): F2[O2]

    Run this Process solely for its final emitted value, if one exists, using o2 otherwise.

  73. final def runLog[F2[x] >: F[x], O2 >: O](implicit F: Monad[F2], C: Catchable[F2]): F2[IndexedSeq[O2]]

    Collect the outputs of this Process[F,O], given a Monad[F] in which we can catch exceptions.

    Collect the outputs of this Process[F,O], given a Monad[F] in which we can catch exceptions. This function is not tail recursive and relies on the Monad[F] to ensure stack safety.

  74. def scan[B](b: B)(f: (B, O) ⇒ B): Process[F, B]

    Connect this Process to process1.scan(b)(f).

  75. def scan1[O2 >: O](f: (O2, O2) ⇒ O2): Process[F, O2]

    Connect this Process to process1.scan1(f).

  76. def scan1Map[M](f: (O) ⇒ M)(implicit M: Monoid[M]): Process[F, M]

    Alias for this |> process1.scan1Map(f)(M).

  77. def scan1Monoid[O2 >: O](implicit M: Monoid[O2]): Process[F, O2]

    Connect this Process to process1.scan1Monoid(M).

  78. def scanMap[M](f: (O) ⇒ M)(implicit M: Monoid[M]): Process[F, M]

    Alias for this |> process1.scanMap(f)(M).

  79. def scanMonoid[O2 >: O](implicit M: Monoid[O2]): Process[F, O2]

    Connect this Process to process1.scanMonoid(M).

  80. def scanSemigroup[O2 >: O](implicit M: Semigroup[O2]): Process[F, O2]

    Connect this Process to process1.scan1Semigroup(M).

  81. def sleepUntil[F2[x] >: F[x], O2 >: O](awaken: Process[F2, Boolean]): Process[F2, O2]

    Delay running this Process until awaken becomes true for the first time.

  82. def split(f: (O) ⇒ Boolean): Process[F, Vector[O]]

    Alias for this |> process1.split(f)

  83. def splitOn[P >: O](p: P)(implicit P: Equal[P]): Process[F, Vector[P]]

    Alias for this |> process1.splitOn(f)

  84. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  85. def take(n: Int): Process[F, O]

    Halts this Process after emitting n elements.

  86. def takeWhile(f: (O) ⇒ Boolean): Process[F, O]

    Halts this Process as soon as the predicate tests false.

  87. final def tee[F2[x] >: F[x], O2, O3](p2: Process[F2, O2])(t: Process.Tee[O, O2, O3]): Process[F2, O3]

    Use a Tee to interleave or combine the outputs of this and p2.

    Use a Tee to interleave or combine the outputs of this and p2. This can be used for zipping, interleaving, and so forth. Nothing requires that the Tee read elements from each Process in lockstep. It could read fifty elements from one side, then two elements from the other, then combine or interleave these values in some way, etc.

    If at any point the Tee awaits on a side that has halted, we gracefully kill off the other side, then halt.

  88. def terminated: Process[F, Option[O]]

    Wraps all outputs in Some, then outputs a single None before halting.

  89. def toString(): String

    Definition Classes
    AnyRef → Any
  90. def translate[G[_]](f: ~>[F, G]): Process[G, O]

    Translate the request type from F to G, using the given polymorphic function.

  91. final def trim: Process[F, O]

    Remove any leading emitted values from this Process.

    Remove any leading emitted values from this Process.

    Annotations
    @tailrec()
  92. final def unemit: (Seq[O], Process[F, O])

    Removes all emitted elements from the front of this Process.

    Removes all emitted elements from the front of this Process. The second argument returned by this method is guaranteed to be an Await or a Halt--if there are multiple Emits at the front of this process, the sequences are concatenated together.

    If this Process does not begin with an Emit, returns the empty sequence along with this.

  93. def until[F2[x] >: F[x], O2 >: O](condition: Process[F2, Boolean]): Process[F2, O2]

    Halts this Process as soon as condition becomes true.

    Halts this Process as soon as condition becomes true. Note that condition is checked before each and every read from this, so condition should return very quickly or be continuous to avoid holding up the output Process. Use condition.forwardFill to convert an infrequent discrete Process to a continuous one for use with this function.

  94. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  95. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  96. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  97. def when[F2[x] >: F[x], O2 >: O](condition: Process[F2, Boolean]): Process[F2, O2]

    When condition is true, lets through any values in this process, otherwise blocks until condition becomes true again.

    When condition is true, lets through any values in this process, otherwise blocks until condition becomes true again. Note that the condition is checked before each and every read from this, so condition should return very quickly or be continuous to avoid holding up the output Process. Use condition.forwardFill to convert an infrequent discrete Process to a continuous one for use with this function.

  98. def window(n: Int): Process[F, Vector[O]]

    Alias for this |> process1.window(n)

  99. final def wye[F2[x] >: F[x], O2, O3](p2: Process[F2, O2])(y: Process.Wye[O, O2, O3])(implicit F2: Nondeterminism[F2], E: Catchable[F2]): Process[F2, O3]

    Like tee, but we allow the Wye to read nondeterministically from both sides at once, using the supplied Nondeterminism instance.

    Like tee, but we allow the Wye to read nondeterministically from both sides at once, using the supplied Nondeterminism instance.

    If y is in the state of awaiting Both, this implementation will continue feeding y until either it halts or _both_ sides halt.

    If y is in the state of awaiting L, and the left input has halted, we halt. Likewise for the right side.

    For as long as y permits it, this implementation will _always_ feed it any leading Emit elements from either side before issuing new F requests. More sophisticated chunking and fairness policies do not belong here, but should be built into the Wye and/or its inputs.

  100. def yip[F2[x] >: F[x], O2](p2: Process[F2, O2])(implicit F: Nondeterminism[F2], E: Catchable[F2]): Process[F2, (O, O2)]

    Nondeterministic version of zip.

  101. def yipWith[F2[x] >: F[x], O2, O3](p2: Process[F2, O2])(f: (O, O2) ⇒ O3)(implicit F: Nondeterminism[F2], E: Catchable[F2]): Process[F2, O3]

    Nondeterministic version of zipWith.

  102. def zip[F2[x] >: F[x], O2](p2: Process[F2, O2]): Process[F2, (O, O2)]

    Call tee with the zip Tee[O,O2,O3] defined in tee.scala.

  103. def zipWith[F2[x] >: F[x], O2, O3](p2: Process[F2, O2])(f: (O, O2) ⇒ O3): Process[F2, O3]

    Call tee with the zipWith Tee[O,O2,O3] defined in tee.scala.

  104. final def |>[O2](p2: Process.Process1[O, O2]): Process[F, O2]

    Operator alias for pipe.

  105. final def |||[F2[x] >: F[x], O2 >: O](p2: ⇒ Process[F2, O2]): Process[F2, O2]

    operator alias for fby

Inherited from AnyRef

Inherited from Any

Ungrouped