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
cont(state: State): Boolean
Decides whether the Sink should continue from the current state.
-
abstract
def
extract(state: State): ZIO[R, E, (B, Chunk[A0])]
Produces a final value of type
Balong with a remainder of typeChunk[A0]. -
abstract
def
initial: ZIO[R, E, State]
The initial state of the sink.
-
abstract
def
step(state: State, a: A): ZIO[R, E, State]
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: =:=[A1, A00]): ZSink[R1, E1, A00, A1, C]
Operator alias for
zipParRight -
final
def
*>[R1 <: R, E1 >: E, A00 >: A0, A1 <: A, C](that: ZSink[R1, E1, A00, A1, C])(implicit ev: =:=[A00, A1], ev2: =:=[A1, A00]): 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: =:=[A1, A00]): 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: =:=[A1, A00]): ZSink[R1, E1, A00, A1, (B, C)]
Operator alias for
zipPar. -
final
def
<*[R1 <: R, E1 >: E, A00 >: A0, A1 <: A, C](that: ZSink[R1, E1, A00, A1, C])(implicit ev: =:=[A00, A1], ev2: =:=[A1, A00]): 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], ev2: =:=[A1, A00]): 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: =:=[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
as[C](c: ⇒ C): ZSink[R, E, A0, A, C]
Creates a sink that always produces
c -
final
def
asError[E1](e1: ⇒ E1): ZSink[R, E1, A0, A, B]
Replaces any error produced by this sink.
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
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
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[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], ev2: =:=[A1, A00]): 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[_]
- 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
orElse[R1 <: R, E1, A00 >: A0, A1 <: A, C](that: ZSink[R1, E1, A00, A1, C])(implicit ev: =:=[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, A00 >: A0, A1 <: A, B1 >: B](that: ZSink[R1, E1, A00, A1, B1]): ZSink[R1, E1, A00, 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, A00 >: A0, A1 <: A, C](that: ZSink[R1, E1, A00, A1, C]): ZSink[R1, E1, A00, 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[A00 >: A0, A1 <: A](state: State, as: Chunk[A1])(implicit ev: =:=[A1, A00]): ZIO[R, E, (State, Chunk[A00])]
Steps through a chunk of iterations of the sink
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
final
def
tapInput[R1 <: R, E1 >: E, A1 <: A](f: (A1) ⇒ ZIO[R1, E1, Unit]): ZSink[R1, E1, A0, A1, B]
Performs the specified effect for every element that is consumed by this sink.
-
final
def
tapOutput[R1 <: R, E1 >: E](f: (B) ⇒ ZIO[R1, E1, Unit]): ZSink[R1, E1, A0, A, B]
Performs the specified effect for every element that is produced by this sink.
-
final
def
timed: ZSink[R with Clock, E, A0, A, (Duration, B)]
Times the invocation of the sink
-
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
update(state: State): ZSink[R, E, A0, A, B]
Sets the initial state of the sink to the provided state.
-
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( ... ) @native()
-
final
def
zip[R1 <: R, E1 >: E, A00 >: A0, A1 <: A, C](that: ZSink[R1, E1, A00, A1, C])(implicit ev: =:=[A00, A1], ev2: =:=[A1, A00]): 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], ev2: =:=[A1, A00]): ZSink[R1, E1, A00, A1, B]
Runs two sinks in unison and keeps only values on the left.
-
final
def
zipPar[R1 <: R, E1 >: E, A00 >: A0, A1 <: A, C](that: ZSink[R1, E1, A00, A1, C])(implicit ev: =:=[A1, A00]): ZSink[R1, E1, A00, A1, (B, C)]
Runs both sinks in parallel on the input and combines the results into a Tuple.
-
final
def
zipParLeft[R1 <: R, E1 >: E, A00 >: A0, A1 <: A, C](that: ZSink[R1, E1, A00, A1, C])(implicit ev: =:=[A1, A00]): ZSink[R1, E1, A00, A1, B]
Runs both sinks in parallel on the input and combines the results into a Tuple.
-
final
def
zipParRight[R1 <: R, E1 >: E, A00 >: A0, A1 <: A, C](that: ZSink[R1, E1, A00, A1, C])(implicit ev: =:=[A1, A00]): ZSink[R1, E1, A00, A1, C]
Runs both sinks in parallel on the input and combines the results into a Tuple.
-
final
def
zipRight[R1 <: R, E1 >: E, A00 >: A0, A1 <: A, C](that: ZSink[R1, E1, A00, A1, C])(implicit ev: =:=[A00, A1], ev2: =:=[A1, A00]): 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], ev2: =:=[A1, A00]): ZSink[R1, E1, A00, A1, D]
Runs two sinks in unison and merges values pair-wise.
-
final
def
zipWithPar[R1 <: R, E1 >: E, A00 >: A0, A1 <: A, C, D](that: ZSink[R1, E1, A00, A1, C])(f: (B, C) ⇒ D)(implicit ev: =:=[A1, A00]): ZSink[R1, E1, A00, A1, D]
Runs both sinks in parallel on the input and combines the results using the provided function.
-
final
def
|[R1 <: R, E1 >: E, A00 >: A0, A1 <: A, B1 >: B](that: ZSink[R1, E1, A00, A1, B1]): ZSink[R1, E1, A00, A1, B1]
A named alias for
race.