Eilenberg--Moore Monoids and Backtracking Monad Transformers
Maciej Pir\'og (Department of Computer Science, KU Leuven, Belgium)

TL;DR
This paper provides an algebraic framework for backtracking monad transformers using Eilenberg--Moore monoids, establishing their properties and connections to list monad transformers in Haskell, with applications to continuation-based implementations.
Contribution
It introduces Eilenberg--Moore monoids in monoidal categories and shows their equivalence to list monad transformer algebras, clarifying their structure and properties.
Findings
List monad transformer is a monad, transformer, and MonadPlus instance
Eilenberg--Moore monoids unify monoids with strong monad algebras
Constructs a continuation-based implementation via codensity monad
Abstract
We develop an algebraic underpinning of backtracking monad transformers in the general setting of monoidal categories. As our main technical device, we introduce Eilenberg--Moore monoids, which combine monoids with algebras for strong monads. We show that Eilenberg--Moore monoids coincide with algebras for the list monad transformer ('done right') known from Haskell libraries. From this, we obtain a number of results, including the facts that the list monad transformer is indeed a monad, a transformer, and an instance of the MonadPlus class. Finally, we construct an Eilenberg--Moore monoid of endomorphisms, which, via the codensity monad construction, yields a continuation-based implementation a la Hinze.
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
