The IO Monad
Pure effects.
What Is IO?
IO[A] from Cats Effect is a description of a computation that, when run, may perform side effects and produce a value of type A. It is a pure value — nothing happens until you run it.
Deferring Side Effects
Wrap a side effect with IO(...) or IO.delay(...). The body is not executed when the IO is created — only when it is run.
import cats.effect.IO
val program: IO[Unit] = IO(println("Hello, IO!"))
// Nothing printed yet — program is just a description