Packages

trait Stream[+E, +A] extends AnyRef

A Stream[E, A] represents an effectful stream that can produce values of type A, or potentially fail with a value of type E.

Streams have a very similar API to Scala collections, making them immediately familiar to most developers. Unlike Scala collections, streams can be used on effectful streams of data, such as HTTP connections, files, and so forth.

Streams do not leak resources. This guarantee holds in the presence of early termination (not all of a stream is consumed), failure, or even interruption.

Thanks to only first-order types, appropriate variance annotations, and specialized effect type (ZIO), streams feature extremely good type inference and should almost never require specification of any type parameters.

Self Type
Stream[E, A]
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Stream
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def fold[E1 >: E, A1 >: A, S]: Fold[E1, A1, S]

    Executes an effectful fold over the stream of values.

Concrete Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ++[E1 >: E, A1 >: A](that: ⇒ Stream[E1, A1]): Stream[E1, A1]

    Concatenates the specified stream to this stream.

  4. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  5. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  6. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  7. def collect[B](pf: PartialFunction[A, B]): Stream[E, B]

    Performs a filter and map in a single step.

  8. final def drop(n: Int): Stream[E, A]

    Drops the specified number of elements from this stream.

  9. def dropWhile(pred: (A) ⇒ Boolean): Stream[E, A]

    Drops all elements of the stream for as long as the specified predicate evaluates to true.

  10. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  11. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  12. def filter(pred: (A) ⇒ Boolean): Stream[E, A]

    Filters this stream by the specified predicate, retaining all elements for which the predicate evaluates to true.

  13. final def filterNot(pred: (A) ⇒ Boolean): Stream[E, A]

    Filters this stream by the specified predicate, removing all elements for which the predicate evaluates to true.

  14. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  15. final def flatMap[E1 >: E, B](f: (A) ⇒ Stream[E1, B]): Stream[E1, B]

    Maps each element of this stream to another stream, and returns the concatenation of those streams.

  16. def foldLeft[A1 >: A, S](s: S)(f: (S, A1) ⇒ S): IO[E, S]
  17. final def foreach[E1 >: E](f: (A) ⇒ IO[E1, Unit]): IO[E1, Unit]

    Consumes all elements of the stream, passing them to the specified callback.

  18. final def foreach0[E1 >: E](f: (A) ⇒ IO[E1, Boolean]): IO[E1, Unit]

    Consumes elements of the stream, passing them to the specified callback, and terminating consumption when the callback returns false.

  19. def forever: Stream[E, A]

    Repeats this stream forever.

  20. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  21. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  22. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  23. def map[B](f: (A) ⇒ B): Stream[E, B]

    Maps over elements of the stream with the specified function.

  24. def mapAccum[S1, B](s1: S1)(f1: (S1, A) ⇒ (S1, B)): Stream[E, B]

    Statefully maps over the elements of this stream to produce new elements.

  25. final def mapAccumM[E1 >: E, S1, B](s1: S1)(f1: (S1, A) ⇒ IO[E1, (S1, B)]): Stream[E1, B]

    Statefully and effectfully maps over the elements of this stream to produce new elements.

  26. def mapConcat[B](f: (A) ⇒ Chunk[B]): Stream[E, B]

    Maps each element to a chunk, and flattens the chunks into the output of this stream.

  27. final def mapM[E1 >: E, B](f: (A) ⇒ IO[E1, B]): Stream[E1, B]

    Maps over elements of the stream with the specified effectful function.

  28. final def merge[E1 >: E, A1 >: A](that: Stream[E1, A1], capacity: Int = 1): Stream[E1, A1]

    Merges this stream and the specified stream together.

  29. final def mergeEither[E1 >: E, B](that: Stream[E1, B], capacity: Int = 1): Stream[E1, Either[A, B]]

    Merges this stream and the specified stream together to produce a stream of eithers.

  30. final def mergeWith[E1 >: E, B, C](that: Stream[E1, B], capacity: Int = 1)(l: (A) ⇒ C, r: (B) ⇒ C): Stream[E1, C]

    Merges this stream and the specified stream together to a common element type with the specified mapping functions.

  31. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  32. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  33. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  34. final def peel[E1 >: E, A1 >: A, R](sink: Sink[E1, A1, A1, R]): Managed[E1, (R, Stream[E1, A1])]

    Peels off enough material from the stream to construct an R using the provided Sink, and then returns both the R and the remainder of the Stream in a managed resource.

    Peels off enough material from the stream to construct an R using the provided Sink, and then returns both the R and the remainder of the Stream in a managed resource. Like all Managed resources, the provided remainder is valid only within the scope of Managed.

  35. def repeat(schedule: Schedule[Unit, _], clock: Clock = Clock.Live): Stream[E, A]

    Repeats the entire stream using the specified schedule.

    Repeats the entire stream using the specified schedule. The stream will execute normally, and then repeat again according to the provided schedule.

  36. def repeatElems[B](schedule: Schedule[A, B], clock: Clock = Clock.Live): Stream[E, A]

    Repeats elements of the stream using the provided schedule.

  37. def run[E1 >: E, A0, A1 >: A, B](sink: Sink[E1, A0, A1, B]): IO[E1, B]

    Runs the sink on the stream to produce either the sink's result or an error.

  38. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  39. final def take(n: Int): Stream[E, A]

    Takes the specified number of elements from this stream.

  40. def takeWhile(pred: (A) ⇒ Boolean): Stream[E, A]

    Takes all elements of the stream for as long as the specified predicate evaluates to true.

  41. final def toQueue[E1 >: E, A1 >: A](capacity: Int = 1): Managed[Nothing, Queue[Take[E1, A1]]]

    Converts the stream to a managed queue.

    Converts the stream to a managed queue. After managed queue is used, the queue will never again produce values and should be discarded.

  42. def toString(): String
    Definition Classes
    AnyRef → Any
  43. final def transduce[E1 >: E, A1 >: A, C](sink: Sink[E1, A1, A1, C]): Stream[E1, C]

    Applies a transducer to the stream, which converts one or more elements of type A into elements of type C.

  44. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  45. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  46. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  47. final def withEffect[E1 >: E](f: (A) ⇒ IO[E1, Unit]): Stream[E1, A]

    Adds an effect to consumption of every element of the stream.

  48. final def zip[E1 >: E, B](that: Stream[E1, B], lc: Int = 1, rc: Int = 1): Stream[E1, (A, B)]

    Zips this stream together with the specified stream.

  49. final def zipWith[E1 >: E, B, C](that: Stream[E1, B], lc: Int = 1, rc: Int = 1)(f: (Option[A], Option[B]) ⇒ Option[C]): Stream[E1, C]

    Zips two streams together with a specified function.

  50. def zipWithIndex: Stream[E, (A, Int)]

    Zips this stream together with the index of elements of the stream.

Inherited from AnyRef

Inherited from Any

Ungrouped