PLDI '88 Proceedings of the ACM SIGPLAN 1988 conference on Programming Language design and Implementation
Unboxed objects and polymorphic typing
POPL '92 Proceedings of the 19th ACM SIGPLAN-SIGACT symposium on Principles of programming languages
Space-efficient closure representations
LFP '94 Proceedings of the 1994 ACM conference on LISP and functional programming
A type-based compiler for standard ML
PLDI '95 Proceedings of the ACM SIGPLAN 1995 conference on Programming language design and implementation
TIL: a type-directed optimizing compiler for ML
PLDI '96 Proceedings of the ACM SIGPLAN 1996 conference on Programming language design and implementation
POPL '96 Proceedings of the 23rd ACM SIGPLAN-SIGACT symposium on Principles of programming languages
Revisiting catamorphisms over datatypes with embedded functions (or, programs from outer space)
POPL '96 Proceedings of the 23rd ACM SIGPLAN-SIGACT symposium on Principles of programming languages
Flexible representation analysis
ICFP '97 Proceedings of the second ACM SIGPLAN international conference on Functional programming
Proceedings of the 24th ACM SIGPLAN-SIGACT symposium on Principles of programming languages
From system F to typed assembly language
POPL '98 Proceedings of the 25th ACM SIGPLAN-SIGACT symposium on Principles of programming languages
From system F to typed assembly language
ACM Transactions on Programming Languages and Systems (TOPLAS)
A type system for certified binaries
POPL '02 Proceedings of the 29th ACM SIGPLAN-SIGACT symposium on Principles of programming languages
Guarded recursive datatype constructors
POPL '03 Proceedings of the 30th ACM SIGPLAN-SIGACT symposium on Principles of programming languages
A Syntactic Approach to Foundational Proof-Carrying Code
LICS '02 Proceedings of the 17th Annual IEEE Symposium on Logic in Computer Science
Implementing typeful program transformations
Proceedings of the 2003 ACM SIGPLAN workshop on Partial evaluation and semantics-based program manipulation
Boxes go bananas: encoding higher-order abstract syntax with parametric polymorphism
ICFP '03 Proceedings of the eighth ACM SIGPLAN international conference on Functional programming
The role of type equality in meta-programming
The role of type equality in meta-programming
Formal certification of a compiler back-end or: programming a compiler with a proof assistant
Conference record of the 33rd ACM SIGPLAN-SIGACT symposium on Principles of programming languages
Strongly typed memory areas programming systems-level data structures in a functional language
Proceedings of the 2006 ACM SIGPLAN workshop on Haskell
System F with type equality coercions
TLDI '07 Proceedings of the 2007 ACM SIGPLAN international workshop on Types in languages design and implementation
A certified type-preserving compiler from lambda calculus to assembly language
Proceedings of the 2007 ACM SIGPLAN conference on Programming language design and implementation
Type-Safe Code Transformations in Haskell
Electronic Notes in Theoretical Computer Science (ENTCS)
A type-preserving compiler in Haskell
Proceedings of the 13th ACM SIGPLAN international conference on Functional programming
Unembedding domain-specific languages
Proceedings of the 2nd ACM SIGPLAN symposium on Haskell
Programming with binders and indexed data-types
POPL '12 Proceedings of the 39th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languages
Names for free: polymorphic views of names and binders
Proceedings of the 2013 ACM SIGPLAN symposium on Haskell
Hi-index | 0.00 |
The use of typed intermediate languages can significantly increase the reliability of a compiler. By type-checking the code produced at each transformation stage, one can identify bugs in the compiler that would otherwise be much harder to find. Also it guarantees that any property that was enforced by the source-level type-system is holds also or the generated code. Recently, several people have tried to push this effort a bit further by verifying formally that the compiler indeed preserves typing. This is usually done with proof assistants or experimental languages. Instead, we decided to use Haskell (with GHC's extensions), to see how far we can go with a more mainstream system, supported by robust compilers and plentiful libraries. This article presents one part of our type preserving compiler, namely the closure conversion and its associated hoisting phase, where we use GADTs to let Haskell's type checker verify the we obey the object language's typing rules and that we correctly preserve types from one phase to the other. This should be both a good showcase as well as a good stress test for GADTs, so we also discuss our experience, as well as some trade-offs in the choice of representation, namely between higher-order abstract syntax (HOAS) and a first order representation (i.e. de Bruijn indices) and justify our choice of a de Bruijn representation. We incidentally present a type preserving conversion from HOAS (used in earlier phases of the compiler[6]) to a de Bruijn representation.