-
I have a |
Beta Was this translation helpful? Give feedback.
Answered by
mpilquist
Nov 25, 2021
Replies: 1 comment 1 reply
-
Use the val p: Pipe[F, Byte, Unit] = ???
val q: Pipe[F, Byte, Nothing] = p.andThen(_.drain) That discarding has to be manual. To see why, consider this program: val s: Stream[Pure, Unit] = Stream(1, 2, 3).as(())
val s2: Stream[Pure, Int] = Stream(4, 5, 6)
val s3 = s ++ s2 What's the type of |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
Fristi
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Use the
.drain
method onStream
to discard those units. For example:That discarding has to be manual. To see why, consider this program:
What's the type of
s3
here? It's aStream[Pure, AnyVal]
becauseAnyVal
is the least upper bound ofUnit
andInt
.