## Accumulating bindings

Citations: | 2 - 0 self |

### BibTeX

@MISC{Lindley_accumulatingbindings,

author = {Sam Lindley},

title = {Accumulating bindings},

year = {}

}

### OpenURL

### Abstract

We give a Haskell implementation of Filinski’s normalisation by evaluation algorithm for the computational lambda-calculus with sums. Taking advantage of extensions to the GHC compiler, our implementation represents object language types as Haskell types and ensures that type errors are detected statically. Following Filinski, the implementation is parameterised over a residualising monad. The standard residualising monad for sums is a continuation monad. Defunctionalising the uses of the continuation monad we present the binding tree monad as an alternative. 1

### Citations

299 | Definitional interpreters for higher-order programming languages
- Reynolds
- 1972
(Show Context)
Citation Context ...ipulates bindings implicitly using functional continuations, the binding tree monad manipulates them explicitly using a binding tree data structure. The binding tree is really just a defunctionalised =-=[16]-=- version of the continuation monad. Having defined two residualising monads we are now in a position to instantiate our normalisation function with either of them: normAccU = normU (eval :: ResEval Ge... |

94 | A.: Representing Control, A
- Danvy, Filinski
- 1992
(Show Context)
Citation Context ...al monad of the metalanguage it is possible to give corresponding algorithms for type-directed partial evaluation. If the metalanguage supports delimited continuations then we can use shift and reset =-=[9]-=- in place of the continuation monad. If the metalanguage supports state then we can use a mutable list of bindings in place of the binding list monad. Filinski demonstrated how to extend his algorithm... |

92 | The zipper
- Huet
- 1997
(Show Context)
Citation Context ...accumulation-based interpretation for normalising sums. There I focused on an implementation using the state supported by the internal monad of the metalanguage. The implementation uses Huet’s zipper =-=[13]-=- to navigate a mutable binding tree. Here we present a Haskell implementation of normalisation by evaluation for the computational lambda calculus using a generalisation of Filinski’s binding list mon... |

55 | Representing layered monads
- Filinski
- 1999
(Show Context)
Citation Context ...continuation monad we present the binding tree monad as an alternative. 1 Introduction Filinski [12] introduced normalisation by evaluation for the computational lambda calculus, using layered monads =-=[11]-=- for formalising name generation and for collecting bindings. He extended his algorithm to handle products and sums, and outlined how to prove correctness using a Kripke logical relation. Filinski’s a... |

39 | Normalization by evaluation for typed lambda calculus with coproducts
- Altenkirch, Dybjer, et al.
- 2001
(Show Context)
Citation Context ...terms are not explicitly named and may in fact be pure, so it is less clear where to insert a case split and one has to be careful about managing redundant case splits. Nevertheless, Altenkirch et al =-=[2]-=- have described a normalisation by evaluation algorithm for call-by-name lambda calculus using categorical techniques, and Balat et al [7] have implemented type-directed partial evaluation for sums us... |

37 | Parameterised notions of computation
- Atkey
- 2009
(Show Context)
Citation Context ... unT$ f (T$ return (Var x)) return (Let x e e’) It would be nice if we could get rid of the boxing (T) and unboxing (unT) in the above instance. If Haskell had better support for parameterised monads =-=[4]-=- then this would be straightforward. Now we can define normalisation functions that statically detect type errors both in the input term and between the type of the input term and the type representat... |

34 | Data types à la carte
- Swierstra
- 2008
(Show Context)
Citation Context ...inding. The operation t >>= f simply descends to the leaves replacing each leaf Val v with the tree f v. It is worth noting that both the binding list monad and the binding tree monad are free monads =-=[18]-=-. The former is the free monad over the functor underlying the datatype: data L a = LetL Var Exp a and the latter is the free monad over the functor underlying the datatype: data T a = LetT Var Exp a ... |

31 |
Extensional normalisation and type-directed partial evaluation for typed lambda calculus with sums, in: POPL’04
- Balat, Cosmo, et al.
- 2004
(Show Context)
Citation Context ...anaging redundant case splits. Nevertheless, Altenkirch et al [2] have described a normalisation by evaluation algorithm for call-by-name lambda calculus using categorical techniques, and Balat et al =-=[7]-=- have implemented type-directed partial evaluation for sums using powerful delimited continuations operators. Lindley [15] has given rewrite rules and shown that simply-typed lambda calculus with sums... |

18 | Normalization by evaluation for the computational lambda-calculus
- Filinski
(Show Context)
Citation Context ...d. The standard residualising monad for sums is a continuation monad. Defunctionalising the uses of the continuation monad we present the binding tree monad as an alternative. 1 Introduction Filinski =-=[12]-=- introduced normalisation by evaluation for the computational lambda calculus, using layered monads [11] for formalising name generation and for collecting bindings. He extended his algorithm to handl... |

16 | A hybrid approach to online and offline partial evaluation
- Sumii, Kobayashi
- 2001
(Show Context)
Citation Context ...te instead of continuations is performance. We might expect a state-based implementation to be faster than an alternative delimited continuationbased implementation. For instance, Sumii and Kobayishi =-=[17]-=- claim a 3-4 times speed-up for state-based versus continuation-based let-insertion. The results of my experiments [14] suggest that in the case of sums it depends on the low-level implementation of t... |

14 | Syntax For Free: Representing Syntax with Binding using Parametricity
- Atkey
- 2009
(Show Context)
Citation Context ...h automatically restricts us to closed terms and makes use of Haskell’s built-in binding. Following Carette et al [8] we use a type class, relying on parametricity to exclude so-called “exotic terms” =-=[5]-=-. class CompLam exp where lam :: (exp → exp) → exp app :: exp → exp → exp inl :: exp → exp inr :: exp → exp case_ :: exp → (exp → exp) → (exp → exp) → exp let_ :: exp → (exp → exp) → exp type Hoas = ∀... |

11 |
Normalization by evaluation with typed abstract syntax
- Danvy, Rhiger, et al.
(Show Context)
Citation Context ...ambda calculus with sums in Haskell. • A generalisation of the binding list monad from binding lists to binding trees allowing it to be plugged into Filinski’s algorithm.2 Implementation Danvy et al =-=[10]-=- give an implementation of normalisation by evaluation for call-by-name simply-typed lambdacalculus in Haskell. Input terms are represented as closed Haskell expressions. The type-indexed reify and re... |

10 | Unembedding domain-specific languages
- Atkey, Lindley, et al.
- 2009
(Show Context)
Citation Context ... exp app :: exp → exp → exp inl :: exp → exp inr :: exp → exp case_ :: exp → (exp → exp) → (exp → exp) → exp let_ :: exp → (exp → exp) → exp type Hoas = ∀exp . CompLam exp ⇒ exp Following Atkey et al =-=[6]-=- it is straightforward to convert from the HOAS representation to the FOAS representation by defining a suitable instance of the CompLam type class. hoasToExp :: Hoas → Exp hoasToExp v = evalGen v 0 i... |

9 | Normalisation by evaluation in the compilation of typed functional programming languages
- Lindley
- 2005
(Show Context)
Citation Context ...ve delimited continuationbased implementation. For instance, Sumii and Kobayishi [17] claim a 3-4 times speed-up for state-based versus continuation-based let-insertion. The results of my experiments =-=[14]-=- suggest that in the case of sums it depends on the low-level implementation of the host language. For SML/NJ, which uses a CPS-based intermediate representation, the delimited continuations-based imp... |

7 |
C.: Finally Tagless, Partially Evaluated
- Carette, Kiselyov, et al.
- 2007
(Show Context)
Citation Context ...about binding. We choose to use higher-order abstract syntax as our input syntax, which automatically restricts us to closed terms and makes use of Haskell’s built-in binding. Following Carette et al =-=[8]-=- we use a type class, relying on parametricity to exclude so-called “exotic terms” [5]. class CompLam exp where lam :: (exp → exp) → exp app :: exp → exp → exp inl :: exp → exp inr :: exp → exp case_ ... |

5 | Extensional rewriting with sums
- Lindley
- 2007
(Show Context)
Citation Context ...for call-by-name lambda calculus using categorical techniques, and Balat et al [7] have implemented type-directed partial evaluation for sums using powerful delimited continuations operators. Lindley =-=[15]-=- has given rewrite rules and shown that simply-typed lambda calculus with sums is confluent and strongly normalising. Altenkirch and Chapman [1] advocate a “bigstep” approach lying somewhere between s... |

3 | Big-step normalisation - Altenkirch, Chapman - 2009 |