Write a Blog >>
ICFP 2016
Sun 18 - Sat 24 September 2016 Nara, Japan
Sat 24 Sep 2016 16:40 - 17:05 at Conference Room 1 - Trees and Lightning Talks

Algebraic datatypes and pattern matching in Haskell lay a fertile ground to conveniently define and process abstract syntax trees (ASTs). However, in Haskell, trees often cannot grow: once a datatype is defined and compiled, it cannot be extended. Extensions to a datatype mainly appear as new fields to its existing data constructors, and/or new data constructors.

At the center of any metaprogramming system stand tall trees representing the abstract syntax of object terms. Metaprograms processing these trees often do so by decorating nodes with additional information. This additional information may appear as new fields to the existing data constructors, and/or new data constructors. Common practice is either post hoc, to define a new separate datatype representing the output decorated trees; or pre hoc, to use the same large datatype to represent both the non-decorated input and the decorated output trees. Both methods are often ad hoc; the former leads to duplication, and the latter forces the input trees to carry an unnecessary set of information making them inconvenient to work with.

In this talk, I introduce an encoding of datatypes that allows them to be extended in a post hoc manner, yet still argueably keeping them convenient to work with. It is done as a part of the the Summer of Haskell project titled “Native Metaprogramming in Haskell”, where we considered unifying the two most popular representations of Haskell’s syntax: the small and convenient AST in the popular library Haskell-Src-Exts (HSE), and the large decorated AST used inside GHC’s front-end (HsSyn).

Sat 24 Sep

Displayed time zone: Osaka, Sapporo, Tokyo change

16:40 - 18:00
Trees and Lightning TalksHIW at Conference Room 1
16:40
25m
Talk
Trees That Grow
HIW
Shayan Najd , Simon Peyton Jones Microsoft Research, UK, Jacques Carette McMaster University
17:05
55m
Other
Lightning talks
HIW