Beauty in the Beast A Functional Semantics for the Awkward Squad

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]  Koen Claessen,et al.  A poor man's concurrency monad , 1999, Journal of Functional Programming.

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

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

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

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

[6]  Uday S. Reddy,et al.  Imperative functional programming , 1996, CSUR.

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

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

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

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

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

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

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

[14]  Andy Gill Debugging Haskell by Observing Intermediate Data Structures , 2000, Electron. Notes Theor. Comput. Sci..

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

[16]  Dirk Pattinson,et al.  Continuous Functions on Final Coalgebras , 2006, CMCS.

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

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

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

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

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

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

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

[24]  Richard S. Bird Unfolding pointer algorithms , 2001, J. Funct. Program..

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

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

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

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

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

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

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

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