An Effect System for Algebraic Effects and Handlers

We present an effect system for core Eff, a simplified variant of Eff, which is an ML-style programming language with first-class algebraic effects and handlers. We define an expressive effect system and prove safety of operational semantics with respect to it. Then we give a domain-theoretic denotational semantics of core Eff, using Pitts's theory of minimal invariant relations, and prove it adequate. We use this fact to develop tools for finding useful contextual equivalences, including an induction principle. To demonstrate their usefulness, we use these tools to derive the usual equations for mutable state, including a general commutativity law for computations using non-interfering references. We have formalized the effect system, the operational semantics, and the safety theorem in Twelf.

[1]  Andrew M. Pitts,et al.  A New Approach to Abstract Syntax with Variable Binding , 2002, Formal Aspects of Computing.

[2]  Gordon D. Plotkin,et al.  Algebraic Operations and Generic Effects , 2003, Appl. Categorical Struct..

[3]  David K. Gifford,et al.  Polymorphic effect systems , 1988, POPL '88.

[4]  Pierre Jouvelot,et al.  Polymorphic type, region and effect inference , 1992, Journal of Functional Programming.

[5]  Eugenio Moggi,et al.  Notions of Computation and Monads , 1991, Inf. Comput..

[6]  Andrej Bauer,et al.  An Effect System for Algebraic Effects and Handlers , 2013, CALCO.

[7]  Gordon D. Plotkin,et al.  Handling Algebraic Effects , 2013, Log. Methods Comput. Sci..

[8]  Gordon D. Plotkin,et al.  Adequacy for Algebraic Effects , 2001, FoSSaCS.

[9]  Matija Pretnar Inferring Algebraic Effects , 2014, Log. Methods Comput. Sci..

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

[11]  Gordon D. Plotkin,et al.  Tensors of Comodels and Models for Operational Semantics , 2008, MFPS.

[12]  Paul Blain Levy,et al.  Call-by-push-value: Decomposing call-by-value and call-by-name , 2006, High. Order Symb. Comput..

[13]  Ohad Kammar,et al.  Handlers in action , 2013, ICFP.

[14]  Matija Pretnar,et al.  Logic and handling of algebraic effects , 2010 .

[15]  Simon L. Peyton Jones,et al.  Once upon a polymorphic type , 1999, POPL '99.

[16]  Ryan Stansifer,et al.  Type inference with subtypes , 1988, POPL '88.

[17]  Roberto M. Amadio,et al.  Domains and lambda-calculi , 1998, Cambridge tracts in theoretical computer science.

[18]  Gordon D. Plotkin,et al.  Handlers of Algebraic Effects , 2009, ESOP.

[19]  Ohad Kammar,et al.  Algebraic foundations for effect-dependent optimisations , 2012, POPL '12.

[20]  Hayo Thielecke,et al.  Modelling environments in call-by-value programming languages , 2003, Inf. Comput..

[21]  John C. Reynolds,et al.  The Meaning of Types From Intrinsic to Extrinsic Semantics , 2000 .

[22]  Gordon D. Plotkin,et al.  Combining effects: Sum and tensor , 2006, Theor. Comput. Sci..

[23]  Ian Stark Categorical models for local names , 1996, LISP Symb. Comput..

[24]  Andrew M. Pitts,et al.  Relational Properties of Domains , 1996, Inf. Comput..

[25]  Frank Pfenning,et al.  System Description: Twelf - A Meta-Logical Framework for Deductive Systems , 1999, CADE.

[26]  Gordon D. Plotkin,et al.  Notions of Computation Determine Monads , 2002, FoSSaCS.

[27]  Gordon D. Plotkin,et al.  A Logic for Algebraic Effects , 2008, 2008 23rd Annual IEEE Symposium on Logic in Computer Science.

[28]  Andrej Bauer,et al.  Programming with algebraic effects and handlers , 2012, J. Log. Algebraic Methods Program..