trait ZSink[-R, +E, +A0, -A, +B] extends AnyRef
A Sink[E, A0, A, B] consumes values of type A, ultimately producing
either an error of type E, or a value of type B together with a remainder
of type A0.
Sinks form monads and combine in the usual ways.
- Self Type
- ZSink[R, E, A0, A, B]
- Alphabetic
- By Inheritance
- ZSink
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
- abstract type State
Abstract Value Members
- abstract def extract(state: State): ZIO[R, E, B]
Runs the sink from an initial state and produces a final value of type
B - abstract def initial: ZIO[R, E, Step[State, Nothing]]
The initial state of the sink.
- abstract def step(state: State, a: A): ZIO[R, E, Step[State, A0]]
Steps through one iteration of the sink
Concrete Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##(): Int
- Definition Classes
- AnyRef → Any
- final def *>[R1 <: R, E1 >: E, A00 >: A0, A1 <: A, C](that: ZSink[R1, E1, A00, A1, C])(implicit ev: =:=[A00, A1]): ZSink[R1, E1, A00, A1, C]
Operator alias for
zipRight - final def <*[R1 <: R, E1 >: E, A00 >: A0, A1 <: A, C](that: ZSink[R1, E1, A00, A1, C])(implicit ev: =:=[A00, A1]): ZSink[R1, E1, A00, A1, B]
Operator alias for
zipLeft - final def <*>[R1 <: R, E1 >: E, A00 >: A0, A1 <: A, C](that: ZSink[R1, E1, A00, A1, C])(implicit ev: =:=[A00, A1]): ZSink[R1, E1, A00, A1, (B, C)]
Operator alias for
zip - final def <|[R1 <: R, E1, B1 >: B, A00 >: A0, A1 <: A](that: ZSink[R1, E1, A00, A1, B1])(implicit ev: =:=[A00, A1], ev2: =:=[A1, A00]): ZSink[R1, E1, A00, A1, B1]
Operator alias for
orElsefor two sinks consuming and producing values of the same type. - final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ?: ZSink[R, Nothing, A0, A, Option[B]]
Returns a new sink that tries to produce the
B, but if there is an error in stepping or extraction, producesNone. - final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- final def chunked[A1 >: A0, A2 <: A]: ZSink[R, E, A1, Chunk[A2], B]
Takes a
Sink, and lifts it to be chunked in its input and output.Takes a
Sink, and lifts it to be chunked in its input and output. This will not improve performance, but can be used to adapt non-chunked sinks wherever chunked sinks are required. - def clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- final def collectAll[A00 >: A0, A1 <: A](implicit ev: =:=[A00, A1]): ZSink[R, E, A00, A1, List[B]]
Accumulates the output into a list.
- final def collectAllN[A00 >: A0, A1 <: A](i: Int)(implicit ev: =:=[A00, A1]): ZSink[R, E, A00, A1, List[B]]
Accumulates the output into a list of maximum size
i. - final def collectAllWhile[A00 >: A0, A1 <: A](p: (A00) => Boolean)(implicit ev: =:=[A00, A1], ev2: =:=[A1, A00]): ZSink[R, E, A00, A1, List[B]]
Accumulates into a list for as long as incoming values verify predicate
p. - final def collectAllWhileWith[S, A00 >: A0, A1 <: A](p: (A00) => Boolean)(z: S)(f: (S, B) => S)(implicit ev: =:=[A00, A1], ev2: =:=[A1, A00]): ZSink[R, E, A00, A1, S]
Accumulates into a value of type
Sfor as long as incoming values verify predicatep. - final def collectAllWith[S, A00 >: A0, A1 <: A](z: S)(f: (S, B) => S)(implicit ev: =:=[A00, A1]): ZSink[R, E, A00, A1, S]
Accumulates the output into a value of type
S. - final def const[C](c: => C): ZSink[R, E, A0, A, C]
Creates a sink that always produces
c - def contramap[C](f: (C) => A): ZSink[R, E, A0, C, B]
Creates a sink where every element of type
Aentering the sink is first transformed byf - final def contramapM[R1 <: R, E1 >: E, C](f: (C) => ZIO[R1, E1, A]): ZSink[R1, E1, A0, C, B]
Creates a sink where every element of type
Aentering the sink is first transformed by the effectfulf - def dimap[C, D](f: (C) => A)(g: (B) => D): ZSink[R, E, A0, C, D]
Creates a sink that transforms entering values with
fand outgoing values withg - final def dropWhile[A1 <: A](pred: (A1) => Boolean): ZSink[R, E, A0, A1, B]
Drops all elements entering the sink for as long as the specified predicate evaluates to
true. - final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def filter[A1 <: A](f: (A1) => Boolean): ZSink[R, E, A0, A1, B]
Filters the inputs fed to this sink.
- final def filterM[R1 <: R, E1 >: E, A1 <: A](f: (A1) => IO[E1, Boolean]): ZSink[R1, E1, A0, A1, B]
Effectfully filters the inputs fed to this sink.
- final def filterNot[A1 <: A](f: (A1) => Boolean): ZSink[R, E, A0, A1, B]
Filters this sink by the specified predicate, dropping all elements for which the predicate evaluates to true.
- final def filterNotM[E1 >: E, A1 <: A](f: (A1) => IO[E1, Boolean]): ZSink[R, E1, A0, A1, B]
Effectfully ilters this sink by the specified predicate, dropping all elements for which the predicate evaluates to true.
- def finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def flatMap[R1 <: R, E1 >: E, A00 >: A0, A1 <: A, C](f: (B) => ZSink[R1, E1, A00, A1, C])(implicit ev: =:=[A00, A1]): ZSink[R1, E1, A00, A1, C]
Creates a sink producing values of type
Cobtained by each produced value of typeBtransformed into a sink byf. - final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def map[C](f: (B) => C): ZSink[R, E, A0, A, C]
Maps the value produced by this sink.
- final def mapError[E1](f: (E) => E1): ZSink[R, E1, A0, A, B]
Maps any error produced by this sink.
- final def mapM[R1 <: R, E1 >: E, C](f: (B) => ZIO[R1, E1, C]): ZSink[R1, E1, A0, A, C]
Effectfully maps the value produced by this sink.
- def mapRemainder[A1](f: (A0) => A1): ZSink[R, E, A1, A, B]
Maps the remainder produced after this sink is done.
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def optional: ZSink[R, Nothing, A0, A, Option[B]]
A named alias for
?. - final def orElse[R1 <: R, E1, A00 >: A0, A1 <: A, C](that: ZSink[R1, E1, A00, A1, C])(implicit ev: =:=[A00, A1], ev2: =:=[A1, A00]): ZSink[R1, E1, A00, A1, Either[B, C]]
Runs both sinks in parallel on the same input.
Runs both sinks in parallel on the same input. If the left one succeeds, its value will be produced. Otherwise, whatever the right one produces will be produced. If the right one succeeds before the left one, it accumulates the full input until the left one fails, so it can return it as the remainder. This allows this combinator to function like
choicein parser combinator libraries.Left: ============== FAIL! Right: ===== SUCCEEDS! xxxxxxxxx <- Should NOT be consumed
- final def provideSome[R1](f: (R1) => R): ZSink[R1, E, A0, A, B]
Narrows the environment by partially building it with
f - final def race[R1 <: R, E1 >: E, A2 >: A0, A1 <: A, B1 >: B](that: ZSink[R1, E1, A2, A1, B1]): ZSink[R1, E1, A2, A1, B1]
Runs both sinks in parallel on the input, returning the result from the one that finishes successfully first.
- final def raceBoth[R1 <: R, E1 >: E, A2 >: A0, A1 <: A, C](that: ZSink[R1, E1, A2, A1, C]): ZSink[R1, E1, A2, A1, Either[B, C]]
Runs both sinks in parallel on the input, returning the result from the one that finishes successfully first.
- final def stepChunk[A1 <: A](state: State, as: Chunk[A1]): ZIO[R, E, Step[State, A0]]
Steps through a chunk of iterations of the sink
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- final def takeWhile[A1 <: A](pred: (A1) => Boolean): ZSink[R, E, A0, A1, B]
Produces a sink consuming all the elements of type
Aas long as they verify the predicatepred. - def toString(): String
- Definition Classes
- AnyRef → Any
- final def unit: ZSink[R, E, A0, A, Unit]
Creates a sink that ignores all produced elements.
- final def untilOutput(f: (B) => Boolean): ZSink[R, E, A0, A, B]
Creates a sink that produces values until one verifies the predicate
f. - final def update(state: Step[State, Nothing]): ZSink[R, E, A0, A, B]
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def zip[R1 <: R, E1 >: E, A00 >: A0, A1 <: A, C](that: ZSink[R1, E1, A00, A1, C])(implicit ev: =:=[A00, A1]): ZSink[R1, E1, A00, A1, (B, C)]
Runs two sinks in unison and matches produced values pair-wise.
- final def zipLeft[R1 <: R, E1 >: E, A00 >: A0, A1 <: A, C](that: ZSink[R1, E1, A00, A1, C])(implicit ev: =:=[A00, A1]): ZSink[R1, E1, A00, A1, B]
Runs two sinks in unison and keeps only values on the left.
- final def zipRight[R1 <: R, E1 >: E, A00 >: A0, A1 <: A, C](that: ZSink[R1, E1, A00, A1, C])(implicit ev: =:=[A00, A1]): ZSink[R1, E1, A00, A1, C]
Runs two sinks in unison and keeps only values on the right.
- final def zipWith[R1 <: R, E1 >: E, A00 >: A0, A1 <: A, C, D](that: ZSink[R1, E1, A00, A1, C])(f: (B, C) => D)(implicit ev: =:=[A00, A1]): ZSink[R1, E1, A00, A1, D]
Runs two sinks in unison and merges values pair-wise.
- final def |[R1 <: R, E1 >: E, A2 >: A0, A1 <: A, B1 >: B](that: ZSink[R1, E1, A2, A1, B1]): ZSink[R1, E1, A2, A1, B1]
A named alias for
race.
Deprecated Value Members
- final def void: ZSink[R, E, A0, A, Unit]
- Annotations
- @deprecated
- Deprecated
(Since version 1.0.0) use unit
- final def ~[R1 <: R, E1 >: E, A00 >: A0, A1 <: A, C](that: ZSink[R1, E1, A00, A1, C])(implicit ev: =:=[A00, A1]): ZSink[R1, E1, A00, A1, (B, C)]
- Annotations
- @deprecated
- Deprecated
(Since version 1.0.0) use <*>