Could not find an implicit IORuntime.
is a common error
when using cats-effect. But what is an IORuntime
, and
how should we use it? In this tutorial, you’ll use cats-effect 3 to
explore the basics of thread pools, execution contexts, and
blocking. You’ll see why the cats-effect
IORuntime.global
is the best model for your application.
You will learn
The difference between blocking and compute‑intensive operations.
What a thread pool is; and about bounded and unbounded thread pools.
What the
IORuntime
is made of, and why cats-effect 3 structures it the way it does.When you should use the
IORuntime.global
(and when you shouldn’t)
I assume you know
A bit about the cats effect
IO
datatype, to the extent that you can create and run anIO
.A bit about concurrency such that you’re not too surprised by parallel computations.
You’ll get the most out of this if cats-effect is your first experience of threads. You’re not too sure what thread pools are (or execution contexts, for that matter), and aren’t as confident in using them as you’d like.
Some caveats
This tutorial won’t teach you how to use cats-effect — and you
certainly don’t need to understand thread pools in order to
use it. If you’re still getting started with IO
and the
basics of parallelism, why not head over to the cats-effect tutorial instead?