Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Another fizz buzz
import fs2._
import cats._
import cats.implicits._
object Fs2FizzBuzz {
val fb = Stream.emits(List(None, None, "Fizz".some)).
repeat.
zip(Stream.emits(List(None, None, None, None, "Buzz".some)).
repeat).
map{
case (a,b) =>
a |+| b
}
def run(n: Int) = fb[IO].map{
case Some(a) => println(a)
case _ =>
}.take(n).
compile.
drain.
unsafeRunSync
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.