Beauty in the beast

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.

[1]  Paul Hudak,et al.  Monad transformers and modular interpreters , 1995, POPL '95.

[2]  Graham Hutton,et al.  Compiling Exceptions Correctly , 2004, MPC.

[3]  Simon Peyton Jones,et al.  Wearing the hair shirt: a retrospective on Haskell (2003) , 2003 .

[4]  J. McKinna FUNCTIONAL PEARL A type-correct , stack-safe , provably correct expression compiler in Epigram , 2006 .

[5]  Lars Birkedal,et al.  Polymorphism and separation in hoare type theory , 2006, ICFP '06.

[6]  Richard S. Bird,et al.  Introduction to functional programming , 1988, Prentice Hall International series in computer science.

[7]  Pierre Castéran,et al.  Interactive Theorem Proving and Program Development , 2004, Texts in Theoretical Computer Science An EATCS Series.

[8]  Christoph Lüth,et al.  Composing monads using coproducts , 2002, ICFP '02.

[9]  Simon L. Peyton Jones,et al.  Imperative functional programming , 1993, POPL '93.

[10]  Nils Anders Danielsson,et al.  Fast and loose reasoning is morally correct , 2006, POPL '06.

[11]  Philip Wadler,et al.  Combining Monads , 1992 .

[12]  Bernard J. Pope Declarative Debugging with Buddha , 2004, Advanced Functional Programming.

[13]  Gerwin Klein,et al.  Running the manual: an approach to high-assurance microkernel development , 2006, Haskell '06.

[14]  William L. Harrison,et al.  The Essence of Multitasking , 2006, AMAST.

[15]  Conor McBride,et al.  The view from the left , 2004, Journal of Functional Programming.

[16]  Paul Hudak,et al.  Arrows, Robots, and Functional Reactive Programming , 2002, Advanced Functional Programming.

[17]  James Cheney,et al.  A lightweight implementation of generics and dynamics , 2002, Haskell '02.

[18]  Koen Claessen,et al.  A poor man's concurrency monad , 1999, Journal of Functional Programming.

[19]  S. Doaitse Swierstra,et al.  Typing dynamic typing , 2002, ICFP '02.

[20]  Gill Andy Debugging Haskell by Observing Intermediate Data Structures , 2001 .

[21]  Simon L. Peyton Jones,et al.  Composable memory transactions , 2005, CACM.

[22]  Koen Claessen,et al.  QuickCheck: a lightweight tool for random testing of Haskell programs , 2000, ICFP.

[23]  Andrew Donald Gordon,et al.  Functional programming and input/output , 1995 .

[24]  Dirk Pattinson,et al.  Continuous Functions on Final Coalgebras , 2009, CMCS.

[25]  Aleksandar Nanevski,et al.  Dependent type theory of stateful higher-order functions , 2005 .

[26]  D. Turner Total Functional Programming , 2004, J. Univers. Comput. Sci..

[27]  Koen Claessen,et al.  Testing monadic code with QuickCheck , 2002, ACM SIGPLAN Notices.

[28]  Peyton Jones,et al.  Haskell 98 language and libraries : the revised report , 2003 .

[29]  Simon Peyton Jones,et al.  Tackling the Awkward Squad: monadic input/output, concurrency, exceptions, and foreign-language calls in Haskell , 2005 .