Skip to main content Accessibility help

Backtracking with cut via a distributive law and left-zero monoids*

  • MACIEJ PIRÓG (a1) and SAM STATON (a2)


We employ the framework of algebraic effects to augment the list monad with the pruning cut operator known from Prolog. We give two descriptions of the resulting monad: as the monad of free left-zero monoids, and as a composition via a distributive law of the list monad and the ‘unary idempotent operation’ monad. The scope delimiter of cut arises as a handler.



Hide All

Research supported by a Royal Society University Research Fellowship and EPSRC Grant EP/N007387/1



Hide All
Baader, F. & Nipkow, T. (1998) Term Rewriting and All That. Cambridge University Press.
Barr, M. & Wells, C. (1985) Toposes, Triples and Theories. Springer-Verlag.
Beck, J. M. (1969) Distributive laws. In Seminar on Triples and Categorical Homology Theory, Lecture Notes in Mathematics, vol. 80. Berlin/Heidelberg: Springer, pp. 119140.
Billaud, M. (1990) Simple operational and denotational semantics for Prolog with cut. Theor. Comput. Sci. 71 (2), 193208.
Bird, R. S. (2006) Functional pearl: A program to solve Sudoku. J. Funct. Progr. 16 (6), 671679.
Cheng, E. (2011) Distributive laws for Lawvere theories. Algebra Universalis. arXiv:1112.3076.
Hinze, R. (2000) Deriving backtracking monad transformers. In Proceedings of the 5th ACM SIGPLAN International Conference on Functional Programming (ICFP '00), pp. 186–197.
Hinze, R. (2012) Kan extensions for program optimisation or: Art and Dan explain an old trick. In Proceedings of Mathematics of Program Construction—11th International Conference, MPC 2012, Lecture Notes in Computer Science, vol. 7342. Berlin/Heidelberg: Springer, pp. 324–362.
Hyland, M. & Power, J. (2006) Discrete Lawvere theories and computational effects. Theor. Comput. Sci. 366 (1), 144162.
Hyland, M., Plotkin, G. D. & Power, J. (2006) Combining effects: Sum and tensor. Theor. Comput. Sci. 357 (1–3), 7099.
Jaskelioff, M. & Moggi, E. (2010) Monad transformers as monoid transformers. Theor. Comput. Sci. 411 (51–52), 44414466.
Mac Lane, S. (1998) Categories for the Working Mathematician, 2nd ed. Springer.
Piróg, M. (2016) Eilenberg–Moore monoids and backtracking monad transformers. In Proceedings 6th Workshop on Mathematically Structured Functional Programming, Electronic Proceedings in Theoretical Computer Science, vol. 207, pp. 23–56.
Plotkin, G. D. & Power, A. J. (2004) Computational effects and operations: An overview. Electron. Notes Theor. Comput. Sci. 73, 149163.
Plotkin, G. D. & Pretnar, M. (2013) Handling algebraic effects. Log. Methods Comput. Sci. 9 (4).

Backtracking with cut via a distributive law and left-zero monoids*

  • MACIEJ PIRÓG (a1) and SAM STATON (a2)


Full text views

Total number of HTML views: 0
Total number of PDF views: 0 *
Loading metrics...

Abstract views

Total abstract views: 0 *
Loading metrics...

* Views captured on Cambridge Core between <date>. This data will be updated every 24 hours.

Usage data cannot currently be displayed.

Backtracking with cut via a distributive law and left-zero monoids*

  • MACIEJ PIRÓG (a1) and SAM STATON (a2)
Submit a response


No Discussions have been published for this article.


Reply to: Submit a response

Your details

Conflicting interests

Do you have any conflicting interests? *