Inside DrMark’s Lab

Inside DrMark’s Lab

Kleisli & Arrow, Without Tears

Compose effects, split tuples, and tame Either like a pro while your coffee is still hot.

The Unshielded Mind's avatar
The Unshielded Mind
Sep 04, 2025
∙ Paid

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.

This post is for paid subscribers

Already a paid subscriber? Sign in
© 2026 Markgrechanik@gmail.com · Privacy ∙ Terms ∙ Collection notice
Start your SubstackGet the app
Substack is the home for great culture