Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
10.1145/1086365.1086390acmconferencesArticle/Chapter ViewAbstractPublication PagesicfpConference Proceedingsconference-collections
Article

Backtracking, interleaving, and terminating monad transformers: (functional pearl)

Published: 12 September 2005 Publication History

Abstract

We design and implement a library for adding backtracking computations to any Haskell monad. Inspired by logic programming, our library provides, in addition to the operations required by the MonadPlus interface, constructs for fair disjunctions, fair conjunctions, conditionals, pruning, and an expressive top-level interface. Implementing these additional constructs is easy in models of backtracking based on streams, but not known to be possible in continuation-based models. We show that all these additional constructs can be generically and monadically realized using a single primitive msplit. We present two implementations of the library: one using success and failure continuations; and the other using control operators for manipulating delimited continuations.

References

[1]
MonadPlus. http://www.haskell.org/hawiki/MonadPlus, 2005.
[2]
ARIOLA, Z. M., HERBELIN, H., AND SABRY, A. A type-theoretic foundation of continuations and prompts. In ACM SIGPLAN International Conference on Functional Programming (2004), ACM Press, New York, pp. 40--53.
[3]
BROMAGE, A. Initial (term) algebra for a state monad. http:// www.haskell.org/pipermail/haskell-cafe/2005-January/008259.html, Jan. 2005.
[4]
BROMAGE, A. A MonadPlusT with fair operations and pruning.http://www.haskell.org/pipermail/haskell/2005-June/016037.html, June 2005.
[5]
DANVY, O., AND FILINSKI, A. Abstracting control. In Proceedings of the 1990 ACM Conference on LISP and Functional Programming, Nice (1990), ACM Press, New York, pp. 151--160.
[6]
DE BRUIN, A., AND DE VINK, E. P. Continuation semantics for PROLOG with cut. In TAPSOFT, Vol.1 (1989), J. Díaz and F. Orejas, Eds., vol. 351 of Lecture Notes in Computer Science, Springer, pp. 178--192.
[7]
DYBVIG, R. K., PEYTON JONES, S. L., AND SABRY, A. A monadic framework for delimited continuations. Tech. Rep. TR615, Department of Computer Science, Indiana University, June 2005.
[8]
FEDERHEN, S. A mathematical semantics for PLANNER. Master's thesis, University of Maryland, 1980.
[9]
FOSCA GIANNOTTI, D. P., AND ZANIOLO, C. Semantics and expressive power of nondeterministic constructs in deductive databases. Journal of Computer and System Sciences 62, 1 (2001), 15--42.
[10]
FRIEDMAN, D. P., AND KISELYOV, O. A declarative applicative logic programming system. http://kanren.sourceforge.net/, 2005.
[11]
HINZE, R. Deriving backtracking monad transformers. In ICFP '00: Proceedings of the 5th ACM SIGPLAN International Conference on Functional Programming (2000), ACM Press, pp. 186--197.

Cited By

View all
  • (2025)From high to low: Simulating nondeterminism and state with stateJournal of Functional Programming10.1017/S095679682400013334Online publication date: 3-Jan-2025
  • (2024)Compiled, Extensible, Multi-language DSLs (Functional Pearl)Proceedings of the ACM on Programming Languages10.1145/36746278:ICFP(64-87)Online publication date: 15-Aug-2024
  • (2024)A Case Study in Functional Conversion and Mode Inference in miniKanrenProceedings of the 2024 ACM SIGPLAN International Workshop on Partial Evaluation and Program Manipulation10.1145/3635800.3636966(107-118)Online publication date: 11-Jan-2024
  • Show More Cited By

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Conferences
ICFP '05: Proceedings of the tenth ACM SIGPLAN international conference on Functional programming
September 2005
342 pages
ISBN:1595930647
DOI:10.1145/1086365
  • cover image ACM SIGPLAN Notices
    ACM SIGPLAN Notices  Volume 40, Issue 9
    Proceedings of the tenth ACM SIGPLAN international conference on Functional programming
    September 2005
    330 pages
    ISSN:0362-1340
    EISSN:1558-1160
    DOI:10.1145/1090189
    Issue’s Table of Contents
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

Sponsors

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 12 September 2005

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. Haskell
  2. Prolog
  3. continuations
  4. control delimiters
  5. logic programming
  6. streams

Qualifiers

  • Article

Conference

ICFP05
Sponsor:

Acceptance Rates

Overall Acceptance Rate 333 of 1,064 submissions, 31%

Upcoming Conference

ICFP '25
ACM SIGPLAN International Conference on Functional Programming
October 12 - 18, 2025
Singapore , Singapore

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)19
  • Downloads (Last 6 weeks)1
Reflects downloads up to 01 Jan 2025

Other Metrics

Citations

Cited By

View all
  • (2025)From high to low: Simulating nondeterminism and state with stateJournal of Functional Programming10.1017/S095679682400013334Online publication date: 3-Jan-2025
  • (2024)Compiled, Extensible, Multi-language DSLs (Functional Pearl)Proceedings of the ACM on Programming Languages10.1145/36746278:ICFP(64-87)Online publication date: 15-Aug-2024
  • (2024)A Case Study in Functional Conversion and Mode Inference in miniKanrenProceedings of the 2024 ACM SIGPLAN International Workshop on Partial Evaluation and Program Manipulation10.1145/3635800.3636966(107-118)Online publication date: 11-Jan-2024
  • (2024)Asymptotic speedup via effect handlersJournal of Functional Programming10.1017/S095679682400003034Online publication date: 5-Apr-2024
  • (2023)The Verse Calculus: A Core Calculus for Deterministic Functional Logic ProgrammingProceedings of the ACM on Programming Languages10.1145/36078457:ICFP(417-447)Online publication date: 31-Aug-2023
  • (2023)Relational Solver for Java Generics Type SystemLogic-Based Program Synthesis and Transformation10.1007/978-3-031-45784-5_8(118-128)Online publication date: 16-Oct-2023
  • (2022)Derivations with Holes for Concept-Based Program SynthesisProceedings of the 2022 ACM SIGPLAN International Symposium on New Ideas, New Paradigms, and Reflections on Programming and Software10.1145/3563835.3567658(63-79)Online publication date: 29-Nov-2022
  • (2022)A New Uncertain Reasoning Approach For Example Selection in the Example-Based Problem Solving Tutoring2022 4th International Workshop on Artificial Intelligence and Education (WAIE)10.1109/WAIE57417.2022.00025(86-91)Online publication date: Nov-2022
  • (2022)Scheduling Complexity of Interleaving SearchFunctional and Logic Programming10.1007/978-3-030-99461-7_9(152-170)Online publication date: 3-May-2022
  • (2022)A Functional Account of Probabilistic Programming with Possible WorldsFunctional and Logic Programming10.1007/978-3-030-99461-7_11(186-204)Online publication date: 3-May-2022
  • Show More Cited By

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media