Usage
Just use io-silent
and make sure the last value the codeblock returns is
of type IO[_]
, for example:
```scala mdoc:io-silent
import cats.effect._
import scala.concurrent.duration._
def go(i: Int): IO[Unit] = i match {
case 0 => IO.unit
case n => IO.sleep(5.millis) *> IO.println(s"tick $i") >> go(n - 1)
}
go(10)
```
Which will be executed, the output captured and rendered separately:
import cats.effect._
import scala.concurrent.duration._
def go(i: Int): IO[Unit] = i match {
case 0 => IO.unit
case n => IO.sleep(5.millis) *> IO.println(s"tick $i") >> go(n - 1)
}
go(10)
tick 10
tick 9
tick 8
tick 7
tick 6
tick 5
tick 4
tick 3
tick 2
tick 1