Kleisli & Arrow, Without Tears
Compose effects, split tuples, and tame Either like a pro while your coffee is still hot.
This tutorial starts with the basics of Kleisli and Arrow, then turns the “how to choose” section into small, copy-ready examples that can be pasted into a REPL. The goal is to help you pick the right construct quickly and write pipelines that are easy to extend and test.
Kleisli is our day-to-day tool: it wraps functions A => IO[B] so we can compose them like pure functions. We can use it whenever we have effectful steps you want to wire together. Arrow. on the other hand is the structure on top of Kleisli that gives us powerful combinators over tuples and eithers.
first/second: act on the left/right of a pair, carry the other half through.
***: run two arrows on a pair in parallel (structurally, not concurrently).
+++ / ||| from ArrowChoice, map or merge Either branches.