Deriving backtracking monad transformers

  • Authors:
  • Ralf Hinze

  • Affiliations:
  • Institut Für Informatik III, Universität Bonn, Römerstraβe 164, 53117 Bonn, Germany

  • Venue:
  • ICFP '00 Proceedings of the fifth ACM SIGPLAN international conference on Functional programming
  • Year:
  • 2000

Quantified Score

Hi-index 0.00

Visualization

Abstract

In a paper about pretty printing J. Hughes introduced two fundamental techniques for deriving programs from their specification, where a specification consists of a signature and properties that the operations of the signature are required to satisfy. Briefly, the first technique, the term implementation, represents the operations by terms and works by defining a mapping from operations to observations --- this mapping can be seen as defining a simple interpreter. The second, the context-passing implementation, represents operations as functions from their calling context to observations. We apply both techniques to derive a backtracking monad transformer that adds backtracking to an arbitrary monad. In addition to the usual backtracking operations --- failure and nondeterministic choice --- the prolog cut and an operation for delimiting the effect of a cut are supported.