Most discussion is on Typelevel Discord: https://discord.gg/bSQBZA3Ced
hold(0L.some)
val nums = Stream.range[IO](1, 10).metered(25.millis)
val chars = Stream.range[IO]('a', 'z' + 1).map(_.toChar).metered(10.millis)
val zipped = for {
a <- nums.noneTerminate.hold(1L.some)
b <- chars.noneTerminate.hold('\0'.some)
c <- (a, b).tupled.map(_.tupled).discrete.unNoneTerminate
} yield c
Option
s get tricky
val nums = Stream.range[IO](1, 10).metered(1.second)
val chars = Stream.range[IO]('a', 'z' + 1).map(_.toChar).metered(500.millis)
val zipped = for {
a <- nums.noneTerminate.hold(0L.some)
b <- chars.noneTerminate.hold('0'.some)
c <- (a, b).mapN(_ product _).discrete.unNoneTerminate
} yield c
(a, b).mapN(_ product _)
On the:
c <- (a, b).mapN(_ product _).discrete.unNoneTerminate
line