Hostname: page-component-5d59c44645-mrcq8 Total loading time: 0 Render date: 2024-02-27T21:48:42.139Z Has data issue: false hasContentIssue false

Monadic constraint programming

Published online by Cambridge University Press:  14 August 2009

Department of Computer Science, K.U.Leuven, Leuven, Belgium (e-mail:
National ICT Australia, Victoria Laboratory, Department of Computer Science and Software Engineering, University of Melbourne, Melbourne, Australia (e-mail:
School of Informatics, University of Edinburgh, Edinburgh, Scotland, UK (e-mail:
Rights & Permissions [Opens in a new window]


Core share and HTML view are not available for this content. However, as you have access to this content, a full PDF is available via the ‘Save PDF’ action button.

A constraint programming system combines two essential components: a constraint solver and a search engine. The constraint solver reasons about satisfiability of conjunctions of constraints, and the search engine controls the search for solutions by iteratively exploring a disjunctive search tree defined by the constraint program. In this paper we give a monadic definition of constraint programming in which the solver is defined as a monad threaded through the monadic search tree. We are then able to define search and search strategies as first-class objects that can themselves be built or extended by composable search transformers. Search transformers give a powerful and unifying approach to viewing search in constraint programming, and the resulting constraint programming system is first class and extremely flexible.

Copyright © Cambridge University Press 2009


Apt, K R., Brunekreef, J., Partington, V. & Schaerf, A. (1998) Alma-o: An imperative language that supports declarative programming, ACM Trans. Program. Lang. Syst. 20 (5): 10141066.Google Scholar
Barnier, N. (Dec. 2002) Application de la programmation par contraintes à des problmes de gestion du trafic aérien, PhD thesis [online]. Toulouse, France: Institut National Polytechnique de Toulouse. Available at: Last accessed 3 August 2009.Google Scholar
Bird, R. S. (2006) A program to solve Sudoku, Journal of Functional Programming 16 (6): 671679.Google Scholar
Brassel, B. & Huch, F. (2007) On a tighter integration of Functional and Logic Programming. In The 5th Asian Symposium on Programming Languages and Systems (APLAS'07), Zhong, Shao (ed), Lecture Notes in Computer Science, vol. 4807. Springer, Berlin/Heidelberg, pp. 122138.Google Scholar
Casas, A., Cabeza, D., & Hermenegildo, M. V. (2006) A syntactic approach to combining functional notation, lazy evaluation and higher-order in LP systems. In The 8th International Symposium on Functional and Logic Programming (FLOPS'06), Hagiya, Masami and Wadler, Philip (eds.), Springer, Berlin/Heidelberg, pp. 146162.Google Scholar
Claessen, K., & Ljunglöf, P. (2000) Typed logical variables in Haskell. In Proceedings of the Haskell Workshop, Montreal, Canada. ACM SIGPLAN.Google Scholar
Cook, W. R. (1989) A Denotational Semantics of Inheritance, PhD thesis. Providence, RI: Brown University.Google Scholar
ECLiPSe. (2008) Eclipse [online]. Available at: Last accessed 3 August 2009.Google Scholar
Fischer, S. (2008) Constrained monadic computations [online]. Available at: Last accessed 3 August 2009.Google Scholar
Frühwirth, T. (1998) Theory and practice of Constraint Handling Rules, J. Logic Program. 37 (1–3): 95138.Google Scholar
Hinze, R. (2001) Prolog's control constructs in a functional setting – axioms and implementation, Int. J Foundations Comp. Sci. 12 (2): 125170.Google Scholar
Jaffar, J. & Lassez, J.-L. (1987) Constraint logic programming. In POPL ‘87: Proceedings of the 14th ACM SIGACT-SIGPLAN Symposium on Principles of Programming Languages. Munich, Germany, pp. 111119.Google Scholar
Jansson, P. & Jeuring, J. (1998) Polytypic unification, J. Funct. Program. 8 (5): 527536.Google Scholar
Kiselyov, O., chiehShan, C. Shan, C., Friedman, D. P. & Sabry, A. (2005) Backtracking, interleaving, and terminating monad transformers (functional pearl), SIGPLAN Not. 40 (9): 192203.Google Scholar
Laburthe, F. & Caseau, Y. (2002) SALSA: A language for search algorithms, Constraints 7 (3): 255288.Google Scholar
Marriott, K. & Stuckey, P. J. (1998) Programming with Constraints: An Introduction. MIT Press, Cambridge, Massachusetts, USA.Google Scholar
Michel, L., See, A. & Hentenryck, P Van. (2006) High-level nondeterministic abstractions in. In Cp, Benhamou F. (ed), Lecture Notes in Computer Science, vol. 4204. Springer, pp. 359–374.Google Scholar
Overton, D. (2008) Haskell FD library [online]. Available at: Last accessed 3 August 2009.Google Scholar
Régin, J.-C. (1994) A filtering algorithm for constraints of difference in csps. In Aaai, pp. 362–367.Google Scholar
Schrijvers, T., PeytonJones, S. Jones, S., Chakravarty, M. & Sulzmann, M. (2008) Type checking with open type functions. In Proceedings of the 13th ACM SIGPLAN international conference on Functional programming. ACM, pp. 51–62.Google Scholar
Schulte, C. (1997) Programming constraint inference engines. In Principles and Practice of Constraint Programming – cp97, Proceedings. Lecture Notes in Computer Science, vol. 1330. Springer, pp. 519533.Google Scholar
Schulte, C. (1999) Comparing trailing and copying for CP. In Proceedings of the 16th International Conference on Logic Programming, De Schreye, D. (ed), Las Cruces, NM: MIT Press, pp. 275289.Google Scholar
Schulte, C., Duchier, D., Konvicka, F., Szokoli, G., Tack, G., Lagerkvist, M., Pekczynski, P., Reischuk, R. & Guns, T. (2009) The Gecode generic constraint development environment [online]. Available at: Last accessed 3 August 2009.Google Scholar
Seres, S. & Spivey, M. J. (Sept. 1999) Embedding Prolog into Haskell. In Haskell Workshop '99. Paris, France.Google Scholar
SICStus. (2008) Sicstus Prolog [online]. Available at: Last accessed 3 August 2009.Google Scholar
Smolka, G. (1995) The Oz programming model. In Computer Science Today, Lecture Notes in Computer Science, vol. 1000. Springer, pp. 324343.Google Scholar
Somogyi, Z., Henderson, F. & Conway, T. (1996) The execution algorithm of Mercury: An efficient purely declarative logic programming language, J. Logic Program. 29 (1–3): 1764.Google Scholar
Van Hentenryck, P. (1999) The OPL Optimization Programming Language. Cambridge, MA: MIT Press.Google Scholar
Van Hentenryck, P. & Michel, L. (2005) Constraint-Based Local Search. MIT Press.Google Scholar
Van Hentenryck, P. & Michel, L. (2006) Nondeterministic control for hybrid search, Constraints 11 (4): 353373.Google Scholar
Van Hentenryck, P., Perron, L., & Puget, J.-F. (2000) Search and strategies in OPL, Acm Tocl. 1 (2): 285315.Google Scholar
Wadler, P. (1985) How to replace failure by a list of successes, In Proceedings of a Conference on Functional Programming Languages and Computer Architecture. New York: Springer, pp. 113128.Google Scholar
Submit a response


No Discussions have been published for this article.