Tackling the Awkward Squad: monadic input/output, concurrency, exceptions, and foreign-language calls in Haskell

Functional programming may be beautiful, but to write real applications we must grapple with awkward real-world issues: input/output, robustness, concurrency, and interfacing to programs written in other languages. These lecture notes give an overview of the techniques that have been developed by the Haskell community to address these problems. I introduce various proposed extensions to Haskell along the way, and I offer an operational semantics that explains what these extensions mean. This tutorial was given at the Marktoberdorf Summer School 2000. It will appears in the book “Engineering theories of software construction, Marktoberdorf Summer School 2000”, ed CAR Hoare, M Broy, and R Steinbrueggen, NATO ASI Series, IOS Press, 2001, pp47-96. This version has a few errors corrected compared with the published version. Change summary:

[1]  David A. Schmidt,et al.  Denotationaisemantics: a methodology for language development , 1986 .

[2]  Lloyd Allison,et al.  A Practical Introduction to Denotational Semantics , 1987 .

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

[4]  John Hughes,et al.  Expressing and Reasoning About Non-Deterministic Functional Programs , 1989, Functional Programming.

[5]  Eugenio Moggi,et al.  Computational lambda-calculus and monads , 1989, [1989] Proceedings. Fourth Annual Symposium on Logic in Computer Science.

[6]  Philip Wadler,et al.  Comprehending monads , 1990, LISP and Functional Programming.

[7]  Pierre Jouvelot,et al.  Algebraic reconstruction of types and effects , 1991, POPL '91.

[8]  Greg Nelson,et al.  Systems programming in modula-3 , 1991 .

[9]  Barry Hayes Finalization in the Collector Interface , 1992, IWMM.

[10]  Robert Hieb,et al.  The Revised Report on the Syntactic Theories of Sequential Control and State , 1992, Theor. Comput. Sci..

[11]  Philip Wadler,et al.  The essence of functional programming , 1992, POPL '92.

[12]  John Launchbury,et al.  A natural semantics for lazy evaluation , 1993, POPL '93.

[13]  Joe Armstrong,et al.  Concurrent programming in ERLANG , 1993 .

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

[15]  Matthias Felleisen,et al.  A Syntactic Approach to Type Soundness , 1994, Inf. Comput..

[16]  Philip Wadler Monads for Functional Programming , 1995, Advanced Functional Programming.

[17]  Erik Barendsen,et al.  Uniqueness Typing for Functional Languages with Graph Rewriting Semantics , 1996, Math. Struct. Comput. Sci..

[18]  Simon Thompson,et al.  Haskell: The Craft of Functional Programming , 1996 .

[19]  Simon L. Peyton Jones,et al.  Concurrent Haskell , 1996, POPL '96.

[20]  Claes Wikström,et al.  Concurrent programming in ERLANG (2nd ed.) , 1996 .

[21]  Simon Peyton Jones,et al.  Green card: a foreign-language interface for Haskell , 1997 .

[22]  Andrew William Roscoe,et al.  The Theory and Practice of Concurrency , 1997 .

[23]  Philip Wadler,et al.  How to declare an imperative , 1997, CSUR.

[24]  Amr Sabry,et al.  Correctness of monadic state: an imperative call-by-need calculus , 1998, POPL '98.

[25]  Nick Benton,et al.  Compiling standard ML to Java bytecodes , 1998, ICFP '98.

[26]  Andrew P. Tolmach,et al.  Optimizing ML Using a Hierarchy of Monadic Types , 1998, Types in Compilation.

[27]  Hans-Wolfgang Loidl,et al.  Algorithm + strategy = parallelism , 1998, Journal of Functional Programming.

[28]  Simon L. Peyton Jones,et al.  H/Direct: a binary foreign language interface for Haskell , 1998, ICFP '98.

[29]  Philip Wadler,et al.  The marriage of effects and monads , 1998, ICFP '98.

[30]  Simon L. Peyton Jones,et al.  Scripting COM components in Haskell , 1998, Proceedings. Fifth International Conference on Software Reuse (Cat. No.98TB100203).

[31]  Daan Leijen,et al.  Haskell as an Automation Controller , 1998, Advanced Functional Programming.

[32]  David Jeffery,et al.  MCORBA: A CORBA Binding for Mercury , 1999, PADL.

[33]  Kevin Hammond,et al.  Research Directions in Parallel Functional Programming , 1999, Springer London.

[34]  Nick Benton,et al.  Monads, Effects and Transformations , 1999, Electron. Notes Theor. Comput. Sci..

[35]  Simon L. Peyton Jones,et al.  A semantics for imprecise exceptions , 1999, PLDI '99.

[36]  Simon L. Peyton Jones,et al.  Stretching the Storage Manager: Weak Pointers and Stable Names in Haskell , 1999, IFL.

[37]  Simon L. Peyton Jones,et al.  Calling hell from heaven and heaven from hell , 1999, ICFP '99.

[38]  Robin Milner,et al.  Communicating and mobile systems - the Pi-calculus , 1999 .

[39]  John Launchbury,et al.  On embedding a microarchitectural design language within Haskell , 1999, ICFP '99.

[40]  John H. Reppy,et al.  Concurrent programming in ML , 1999 .

[41]  Paul Hudak,et al.  The Haskell School of Expression , 2000 .

[42]  Erik Meijer,et al.  Lambada, Haskell as a Better Java , 2000, Electron. Notes Theor. Comput. Sci..

[43]  Simon L. Peyton Jones,et al.  Asynchronous exceptions in Haskell , 2001, PLDI '01.