Download PDF

Journal of functional programming

Publication date: 2009-11-01
Volume: 19 Pages: 663 - 697
ISSN: 0956-7968
Publisher: Cambridge University Press

Author:

Schrijvers, Tom
Stuckey, Peter ; Wadler, Philip

Keywords:

Haskell, constraint programming, monads, search transformers, Science & Technology, Technology, Computer Science, Software Engineering, Computer Science, 0102 Applied Mathematics, 0103 Numerical and Computational Mathematics, 0803 Computer Software, Software Engineering, 4612 Software engineering, 4613 Theory of computation

Abstract:

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 where 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.