skip to main content
10.1145/1291201.1291206acmconferencesArticle/Chapter ViewAbstractPublication PagesicfpConference Proceedingsconference-collections
Article

Beauty in the beast

Published:30 September 2007Publication History

ABSTRACT

It can be very difficult to debug impure code, let alone prove its correctness. To address these problems, we provide a functional specification of three central components of Peyton Jones's awkward squad: teletype IO, mutable state, and concurrency. By constructing an internal model of such concepts within our programming language, we can test, debug, and reason about programs that perform IO as if they were pure. In particular, we demonstrate how our specifications may be used in tandem with QuickCheck to automatically test complex pointer algorithms and concurrent programs.

References

  1. Arthur I. Baars and S. Doaitse Swierstra. Typing Dynamic Typing. In ICFP '02: Proceedings of the Seventh ACM SIGPLAN International Conference on Functional Programming, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Yves Bertot and Pierre Castéran. Interactive Theorem Proving and Program Development. Coq'Art: The Calculus of Inductive Constructions. Texts in Theoretical Computer Science. Springer Verlag, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Richard Bird. Functional Pearl: Unfolding pointer algorithms. Journal of Functional Programming, 11(3):347--358, 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. Richard Bird and Philip Wadler. An Introduction to Functional Programming. Prentice Hall, 1988. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. James Cheney and Ralf Hinze. A Lightweight Implementation of Generics and Dynamics. In Manuel Chakravarty, editor, Proceedings of the 2002 ACM SIGPLAN Haskell Workshop, pages 90--104. ACM-Press, October 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Koen Claessen. A Poor Man's Concurrency Monad. In Journal of Functional Programming, volume 9, pages 313--323. Cambridge University Press, May 1999. Google ScholarGoogle Scholar
  7. Koen Claessen and John Hughes. QuickCheck: A Lightweight Tool for Random Testing of Haskell Programs. In ICFP '00: Proceedings of the Fifth ACM SIGPLAN International Conference on Functional Programming, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Koen Claessen and John Hughes. Testing Monadic Code with QuickCheck. In Proceedings of the 2002 ACM SIGPLAN Haskell Workshop, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Nils Anders Danielsson, John Hughes, Patrik Jansson, and Jeremy Gibbons. Fast and Loose Reasoning is Morally Correct. In Conference record of the 33rd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 206--217, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Philip Derrin, Kevin Elphinstone, Gerwin Klein, David Cock, and Manuel M. T. Chakravarty. Running the manual: an approach to high-assurance microkernel development. In Haskell '06: Proceedings of the 2006 ACM SIGPLAN workshop on Haskell, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Neil Ghani, Peter Hancock, and Dirk Pattinson. Continuous Functions on Final Coalgebras. Electronic Notes in Theoretical Computer Science, 164(1):141--155, 2006.Google ScholarGoogle ScholarCross RefCross Ref
  12. Andy Gill. Debugging Haskell by Observing Intermediate Data Structures. In Proceedings of the 4th Haskell Workshop, 2000.Google ScholarGoogle Scholar
  13. Andrew D. Gordon. Functional Programming and Input/Output. PhD thesis, University of Cambridge, 1992.Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Tim Harris, Simon Marlow, Simon Peyton Jones, and Maurice Herlihy. Composable Memory Transactions. In Proceedings of the tenth ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming, pages 48--60, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. William L. Harrison. The Essence of Multitasking. In Michael Johnson and Varmo Vene, editors, Proceedings of the 11th International Conference on Algebraic Methodology and Software Technology, volume 4019 of Lecture Notes in Computer Science, pages 158--172. Springer, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. Sören Holmström. PFL: A Functional Language for Parallel Programming. In Declarative Programming Workshop, pages 114--139, 1983.Google ScholarGoogle Scholar
  17. Paul Hudak, Antony Courtney, Henrik Nilsson, and John Peterson. Arrows, Robots, and Functional Reactive Programming. In Summer School on Advanced Functional Programming, volume 2638 of Lecture Notes in Computer Science, pages 159--187. Springer, 2003.Google ScholarGoogle Scholar
  18. Graham Hutton and Joel Wright. Compiling Exceptions Correctly. In Proceedings of the 7th International Conference on Mathematics of Program Construction, volume 3125 of Lecture Notes in Computer Science. Springer, 2004.Google ScholarGoogle Scholar
  19. Kent Karlsson. Nebula: A Functional Operating System. Technical report, Chalmers University of Technology, 1981.Google ScholarGoogle Scholar
  20. David J. King and Philip Wadler. Combining monads. In John Launchbury and Patrick M. Sansom, editors, Proceedings of the Glasgow Workshop on Functional Programming, pages 134--143, Glasgow, 1992. Springer. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. Sheng Liang, Paul Hudak, and Mark Jones. Monad transformers and modular interpreters. In Conference record of the 22nd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 333--343, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. Christoph Lüth and Neil Ghani. Composing Monads Using Coproducts. In Proceedings of the 7th ACM SIGPLAN International Conference on Functional Programming, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. Conor McBride and James McKinna. The view from the left. Journal of Functional Programming, 14(1):69--111, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. James McKinna and Joel Wright. A type-correct, stack-safe, provably correct, expression compiler in Epigram. Submitted to the Journal of Functional Programming, 2006.Google ScholarGoogle Scholar
  25. Aleksandar Nanevski and Greg Morrisett. Dependent type theory of stateful higher-order functions. Technical Report TR-24-05, Harvard University, 2005.Google ScholarGoogle Scholar
  26. Aleksandar Nanevski, Greg Morrisett, and Lars Birkedal. Polymorphism and separation in hoare type theory. In Proceedings of th Eleventh ACM SIGPLAN Internation Conference on Functional Programming, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. Ulf Norell. Agda 2. Available online.Google ScholarGoogle Scholar
  28. Simon Peyton Jones. Tackling the Awkward Squad: monadic input/output, concurrency, exceptions, and foreign-language calls in Haskell. In Engineering theories of software construction, 2002.Google ScholarGoogle Scholar
  29. Simon Peyton Jones, editor. Haskell 98 Language and Libraries - The Revised Report. Cambridge University Press, 2003.Google ScholarGoogle Scholar
  30. Simon Peyton Jones. Wearing the hair shirt: a retrospective on Haskell. Invited talk at the 30th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, 2003.Google ScholarGoogle Scholar
  31. Simon L. Peyton Jones and Philip Wadler. Imperative functional programming. In Conference record of the 20th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. Bernard Pope. Declarative debugging with Buddha. In Summer School on Advanced Functional Programming, volume 3622 of Lecture Notes in Computer Science, pages 273--308. Springer, 2005. Google ScholarGoogle Scholar
  33. D. A. Turner. Total functional programming. Journal of Universal Computer Science, 10(7):751--768, 2004.Google ScholarGoogle Scholar

Index Terms

  1. Beauty in the beast

          Recommendations

          Comments

          Login options

          Check if you have access through your login credentials or your institution to get full access on this article.

          Sign in
          • Published in

            cover image ACM Conferences
            Haskell '07: Proceedings of the ACM SIGPLAN workshop on Haskell workshop
            September 2007
            126 pages
            ISBN:9781595936745
            DOI:10.1145/1291201

            Copyright © 2007 ACM

            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]

            Publisher

            Association for Computing Machinery

            New York, NY, United States

            Publication History

            • Published: 30 September 2007

            Permissions

            Request permissions about this article.

            Request Permissions

            Check for updates

            Qualifiers

            • Article

            Acceptance Rates

            Overall Acceptance Rate57of143submissions,40%

            Upcoming Conference

            ICFP '24

          PDF Format

          View or Download as a PDF file.

          PDF

          eReader

          View online with eReader.

          eReader