-
Couldn't load subscription status.
- Fork 1.4k
Closed
Labels
Description
Take is a type alias for Exit[Option[E], Chunk[A]]. This represents a step in a stream:
Exit.succeed(Chunk)is an emission of a chunk;Exit.fail(Some(E))is a stream failure;Exit.fail(None)is an end-of-stream;Exit.halt(Die/Interrupt)are defects as usual.
In this ticket, we will convert it to the following form:
case class Take[E, A](exit: Exit[Option[E], Chunk[A]]) extends AnyValAnd provide the following facilities:
- An object with common constructors that forward to
Exitconstructors with adapations to the error/value types:Take.succeed(A)Take.succeed(Chunk[A])Take.fail(E)Take.halt(Cause[E])Take.endTake.die(Throwable)Take.dieMessage(String)Take.done(Exit[E, A])
- Folds for deconstructing
Takevalues:
def fold[R, E, Z](end: => Z, error: Cause[E] => Z, value: Chunk[A] => Z): Z
def foldM[R, E1, Z](end: => ZIO[R, E1, Z], error: Cause[E] => ZIO[R, E1, Z], value: Chunk[A] => ZIO[R, E1, Z]): ZIO[R, E1, Z]- The minimal subset of combinators required to port ZStream from using
Exitdirectly to usingTake