... | ... | @@ -3,11 +3,11 @@ |
|
|
|
|
|
In this page, we discuss the overall plan and details of implementing Trees that Grow in GHC. Re-engineering `HsSyn` is a major exercise that touches a lot of code, so we need to move carefully. This page outlines the plan.
|
|
|
|
|
|
- [ The Trees that Grow paper](http://www.jucs.org/jucs_23_1/trees_that_grow/jucs_23_01_0042_0062_najd.pdf)
|
|
|
- The motivation and some background information can be found at the [ report](https://ghc.haskell.org/trac/ghc/wiki/NativeMetaprogramming) of a related Summer of Haskell project.
|
|
|
- [The Trees that Grow paper](http://www.jucs.org/jucs_23_1/trees_that_grow/jucs_23_01_0042_0062_najd.pdf)
|
|
|
- The motivation and some background information can be found at the [report](https://ghc.haskell.org/trac/ghc/wiki/NativeMetaprogramming) of a related Summer of Haskell project.
|
|
|
- [Notes about instances](implementing-trees-that-grow/instances)
|
|
|
- Main GHC branch: `wip/GrowableAST`
|
|
|
- [\#14490](https://gitlab.haskell.org//ghc/ghc/issues/14490): TTG snags
|
|
|
- [\#14490](https://gitlab.haskell.org/ghc/ghc/issues/14490): TTG snags
|
|
|
- [Potential use for adding IDE support](implementing-trees-that-grow/ide-support)
|
|
|
- [A set of advises for GHC developers on how to work with TTG](implementing-trees-that-grow/trees-that-grow-guidance)
|
|
|
- [Handling Source Locations](implementing-trees-that-grow/handling-source-locations)
|
... | ... | @@ -30,7 +30,7 @@ The shorter term plan is to validate the idea by applying it to GHC. That is, r |
|
|
|
|
|
A major benefit is that we believe that this re-engineering will
|
|
|
|
|
|
- Completely subsume Alan Zimmerman's [ Api Annotations](https://ghc.haskell.org/trac/ghc/wiki/ApiAnnotations), making them much easier to use.
|
|
|
- Completely subsume Alan Zimmerman's [Api Annotations](https://ghc.haskell.org/trac/ghc/wiki/ApiAnnotations), making them much easier to use.
|
|
|
- Allow us to get rid of the annoying alternation between `t` and `Located t`, which pervades `HsSyn`
|
|
|
|
|
|
## Status
|
... | ... | @@ -42,13 +42,13 @@ We also split the overall work into multiple smaller patches, by working on a se |
|
|
|
|
|
### Step 0 (Done, Accepted, and Landed)
|
|
|
|
|
|
[ Patch D3609](https://phabricator.haskell.org/D3609)
|
|
|
[Patch D3609](https://phabricator.haskell.org/D3609)
|
|
|
|
|
|
### Step 1 & 3
|
|
|
|
|
|
#### Patch 1 (Done)
|
|
|
|
|
|
[ Patch D4147](https://phabricator.haskell.org/D4147) implements TtG for
|
|
|
[Patch D4147](https://phabricator.haskell.org/D4147) implements TtG for
|
|
|
|
|
|
- `ValBinds`
|
|
|
- `HsPat`
|
... | ... | @@ -62,7 +62,7 @@ We also split the overall work into multiple smaller patches, by working on a se |
|
|
|
|
|
|
|
|
Overall, the implementation follows TtG paper with some details captured below.
|
|
|
Further details can be found in the patch description, and also there is a related [ ticket](https://ghc.haskell.org/trac/ghc/ticket/14429).
|
|
|
Further details can be found in the patch description, and also there is a related [ticket](https://ghc.haskell.org/trac/ghc/ticket/14429).
|
|
|
|
|
|
## General Plan
|
|
|
|
... | ... | @@ -74,7 +74,7 @@ It is done in four steps. |
|
|
### Step 0
|
|
|
|
|
|
|
|
|
We replace the current `HsSyn` with one using a type parameter that can enable the growable base AST, as proposed in [ D3609](https://phabricator.haskell.org/D3609).
|
|
|
We replace the current `HsSyn` with one using a type parameter that can enable the growable base AST, as proposed in [D3609](https://phabricator.haskell.org/D3609).
|
|
|
|
|
|
### Step 1
|
|
|
|
... | ... | @@ -186,7 +186,7 @@ In the above example the `XFoo` variant could be produced by the renamer or type |
|
|
## Experiment 1
|
|
|
|
|
|
|
|
|
There is an experimental implementation at [ https://github.com/alanz/ghc/tree/wip/new-tree-one-param](https://github.com/alanz/ghc/tree/wip/new-tree-one-param).
|
|
|
There is an experimental implementation at [https://github.com/alanz/ghc/tree/wip/new-tree-one-param](https://github.com/alanz/ghc/tree/wip/new-tree-one-param).
|
|
|
|
|
|
|
|
|
The intention is to
|
... | ... | @@ -208,7 +208,7 @@ data GhcTh -- Template Haskell. Currently unused |
|
|
```
|
|
|
|
|
|
|
|
|
This is a deviation from the *Trees that Grow* paper ([ http://www.jucs.org/jucs_23_1/trees_that_grow/jucs_23_01_0042_0062_najd.pdf](http://www.jucs.org/jucs_23_1/trees_that_grow/jucs_23_01_0042_0062_najd.pdf)) section 4.2 which suggests
|
|
|
This is a deviation from the *Trees that Grow* paper ([http://www.jucs.org/jucs_23_1/trees_that_grow/jucs_23_01_0042_0062_najd.pdf](http://www.jucs.org/jucs_23_1/trees_that_grow/jucs_23_01_0042_0062_najd.pdf)) section 4.2 which suggests
|
|
|
|
|
|
|
|
|
```
|
... | ... | @@ -456,7 +456,7 @@ Can this be done? How? |
|
|
|
|
|
>
|
|
|
>
|
|
|
> I was talking to Ben, Simon et al about your big patch [ https://phabricator.haskell.org/D3935](https://phabricator.haskell.org/D3935), which \> is Step 1 of [ https://ghc.haskell.org/trac/ghc/wiki/ImplementingTreesThatGrow](https://ghc.haskell.org/trac/ghc/wiki/ImplementingTreesThatGrow).
|
|
|
> I was talking to Ben, Simon et al about your big patch [https://phabricator.haskell.org/D3935](https://phabricator.haskell.org/D3935), which \> is Step 1 of [ https://ghc.haskell.org/trac/ghc/wiki/ImplementingTreesThatGrow](https://ghc.haskell.org/trac/ghc/wiki/ImplementingTreesThatGrow).
|
|
|
>
|
|
|
>
|
|
|
>
|
... | ... | @@ -484,7 +484,7 @@ Can this be done? How? |
|
|
>
|
|
|
|
|
|
|
|
|
This experiment is taking place at [ https://github.com/ghc/ghc/tree/wip/ttg-2017-10-13](https://github.com/ghc/ghc/tree/wip/ttg-2017-10-13)
|
|
|
This experiment is taking place at [https://github.com/ghc/ghc/tree/wip/ttg-2017-10-13](https://github.com/ghc/ghc/tree/wip/ttg-2017-10-13)
|
|
|
|
|
|
### Rough notes based on starting the work (AZ)
|
|
|
|
... | ... | |