Results 1  10
of
17
Unembedding DomainSpecific Languages
"... Higherorder abstract syntax provides a convenient way of embedding domainspecific languages, but is awkward to analyse and manipulate directly. We explore the boundaries of higherorder abstract syntax. Our key tool is the unembedding of embedded terms as de Bruijn terms, enabling intensional anal ..."
Abstract

Cited by 19 (2 self)
 Add to MetaCart
Higherorder abstract syntax provides a convenient way of embedding domainspecific languages, but is awkward to analyse and manipulate directly. We explore the boundaries of higherorder abstract syntax. Our key tool is the unembedding of embedded terms as de Bruijn terms, enabling intensional analysis. As part of our solution we present techniques for separating the definition of an embedded program from its interpretation, giving modular extensions of the embedded language, and different ways to encode the types of the embedded language.
A fresh look at programming with names and binders
"... A wide range of computer programs, including compilers and theorem provers, manipulate data structures that involve names and binding. However, the design of programming idioms which allow performing these manipulations in a safe and natural style has, to a large extent, remained elusive. In this pa ..."
Abstract

Cited by 12 (3 self)
 Add to MetaCart
A wide range of computer programs, including compilers and theorem provers, manipulate data structures that involve names and binding. However, the design of programming idioms which allow performing these manipulations in a safe and natural style has, to a large extent, remained elusive. In this paper, we present a novel approach to the problem. Our proposal can be viewed either as a programming language design or as a library: in fact, it is currently implemented within Agda. enough to support multiple concrete implementations: we present one in nominal style and one in de Bruijn style. We use logical relations to prove that “welltyped programs do not mix names with different scope”. We exhibit an adequate encoding of Pittsstyle nominal terms into our system. Keywords: names, binders, metaprogramming, name abstraction, higherorder abstract syntax
Functional programming with structured graphs
 In Proceedings of the 17th ACM SIGPLAN international conference on Functional programming, ICFP ’12
, 2012
"... This paper presents a new functional programming model for graph structures called structured graphs. Structured graphs extend conventional algebraic datatypes with explicit definition and manipulation of cycles and/or sharing, and offer a practical and convenient way to program graphs in functional ..."
Abstract

Cited by 11 (1 self)
 Add to MetaCart
(Show Context)
This paper presents a new functional programming model for graph structures called structured graphs. Structured graphs extend conventional algebraic datatypes with explicit definition and manipulation of cycles and/or sharing, and offer a practical and convenient way to program graphs in functional programming languages like Haskell. The representation of sharing and cycles (edges) employs recursive binders and uses an encoding inspired by parametric higherorder abstract syntax. Unlike traditional approaches based on mutable references or node/edge lists, wellformedness of the graph structure is ensured statically and reasoning can be done with standard functional programming techniques. Since the binding structure is generic, we can define many useful generic combinators for manipulating structured graphs. We give applications and show how to reason about structured graphs.
Relational Parametricity for Higher Kinds
"... Abstract. Reynolds ’ notion of relational parametricity has been extremely influential and well studied for polymorphic type theories such as System F. The extension of relational parametricity to higher kinded polymorphism, which allows quantification over type operators as well as types, has not b ..."
Abstract

Cited by 7 (0 self)
 Add to MetaCart
Abstract. Reynolds ’ notion of relational parametricity has been extremely influential and well studied for polymorphic type theories such as System F. The extension of relational parametricity to higher kinded polymorphism, which allows quantification over type operators as well as types, has not been as well studied. In this paper we give a model of relational parametricity for System F ω and investigate some of its consequences. 1
Accumulating bindings
"... We give a Haskell implementation of Filinski’s normalisation by evaluation algorithm for the computational lambdacalculus 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 sta ..."
Abstract

Cited by 2 (0 self)
 Add to MetaCart
(Show Context)
We give a Haskell implementation of Filinski’s normalisation by evaluation algorithm for the computational lambdacalculus 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
A Deep Embedding of Parametric Polymorphism in Coq
"... We describe a deep embedding of System F inside Coq, along with a denotational semantics that supports reasoning using Reynolds parametricity [4]. The denotations of System F types are given exactly by objects of sort Set in Coq, and the relations ..."
Abstract

Cited by 2 (0 self)
 Add to MetaCart
(Show Context)
We describe a deep embedding of System F inside Coq, along with a denotational semantics that supports reasoning using Reynolds parametricity [4]. The denotations of System F types are given exactly by objects of sort Set in Coq, and the relations
N.: Names for free: polymorphic views of names and binders
 In: Proceedings of the 2013 ACM SIGPLAN symposium on Haskell
, 2013
"... We propose a novel technique to represent names and binders in Haskell. The dynamic (runtime) representation is based on de Bruijn indices, but it features an interface to write and manipulate variables conviently, using Haskelllevel lambdas and variables. The key idea is to use rich types: a su ..."
Abstract

Cited by 2 (0 self)
 Add to MetaCart
We propose a novel technique to represent names and binders in Haskell. The dynamic (runtime) representation is based on de Bruijn indices, but it features an interface to write and manipulate variables conviently, using Haskelllevel lambdas and variables. The key idea is to use rich types: a subterm with an additional free variable is viewed either as ∀v.v → Term(a + v) or ∃v.v × Term(a + v) depending on whether it is constructed or analysed. We demonstrate on a number of examples how this approach permits to express term construction and manipulation in a natural way, while retaining the good properties of representations based on de Bruijn indices.
Abstraction and Invariance for Algebraically Indexed Types
"... Reynolds ’ relational parametricity provides a powerful way to reason about programs in terms of invariance under changes of data representation. A dazzling array of applications of Reynolds ’ theory exists, exploiting invariance to yield “free theorems”, noninhabitation results, and encodings of al ..."
Abstract

Cited by 1 (0 self)
 Add to MetaCart
(Show Context)
Reynolds ’ relational parametricity provides a powerful way to reason about programs in terms of invariance under changes of data representation. A dazzling array of applications of Reynolds ’ theory exists, exploiting invariance to yield “free theorems”, noninhabitation results, and encodings of algebraic datatypes. Outside computer science, invariance is a common theme running through many areas of mathematics and physics. For example, the area of a triangle is unaltered by rotation or flipping. If we scale a triangle, then we scale its area, maintaining an invariant relationship between the two. The transformations under which properties are invariant are often organised into groups, with the algebraic structure reflecting the composability and invertibility of transformations. In this paper, we investigate programming languages whose types are indexed by algebraic structures such as groups of geometric transformations. Other examples include types indexed by principals–for information flow security–and types indexed by distances–for analysis of analytic uniform continuity properties. Following Reynolds, we prove a general Abstraction Theorem that covers all these instances. Consequences of our Abstraction Theorem include free theorems expressing invariance properties of programs, type isomorphisms based on invariance properties, and nondefinability results indicating when certain algebraically indexed types are uninhabited or only inhabited by trivial programs. We have fully formalised our framework and most examples in Coq.
Typed Tagless Final Interpreters
"... The socalled ‘typed tagless final’ approach of Carette et al. [6] has collected and polished a number of techniques for representing typed higherorder languages in a typed metalanguage, along with typepreserving interpretation, compilation and partial evaluation. The approach is an alternative to ..."
Abstract

Cited by 1 (0 self)
 Add to MetaCart
The socalled ‘typed tagless final’ approach of Carette et al. [6] has collected and polished a number of techniques for representing typed higherorder languages in a typed metalanguage, along with typepreserving interpretation, compilation and partial evaluation. The approach is an alternative to the traditional, or ‘initial ’ encoding of an object language as a (generalized) algebraic data type. Both approaches permit multiple interpretations of an expression, to evaluate it, prettyprint, etc. The final encoding represents all and only typed object terms without resorting to generalized algebraic data types, dependent or other fancy types. The final encoding lets us add new language forms and interpretations without breaking the existing terms and interpreters. These lecture notes introduce the final approach slowly and in detail, highlighting extensibility, the solution to the expression problem, and the seemingly impossible patternmatching. We develop the approach further, to typesafe cast, runtimetype representation, Dynamics, and type reconstruction. We finish with telling examples of typedirected partial evaluation and encodings of typeandeffect systems and linear lambdacalculus.
Embedding F
, 2012
"... This millennium has seen a great deal of research into embedded domainspecific languages. Primarily, such languages are simplytyped. Focusing on System F, we demonstrate how to embed polymorphic domain specific languages in Haskell and OCaml. We exploit recent language extensions including kind po ..."
Abstract

Cited by 1 (0 self)
 Add to MetaCart
This millennium has seen a great deal of research into embedded domainspecific languages. Primarily, such languages are simplytyped. Focusing on System F, we demonstrate how to embed polymorphic domain specific languages in Haskell and OCaml. We exploit recent language extensions including kind polymorphism and firstclass modules.