I am very excited for Coordination for structured error messages by goldfirere · Pull Request #24 · haskellfoundation/tech-proposals · GitHub, and I would like to do something similar for Trees That Grow.
Goals
Trees that grow (see implementing trees that grow · Wiki · Glasgow Haskell Compiler / GHC · GitLab, might need to be more up-to-date) is a project to get a single extensible Haskell AST for all our needs. The parts within GHC are mostly done, and this is what remains:
Make ghc-lib-parser
a real package
ghc-lib-parser
is currently extracted from ghc
and contains far more of GHC than it should. We should continue trimming down the AST and parser so they can live in actually standalone package(s), without extra cruft. (ghc-lib-parser
could be a single package with both, or it could be just parser and depend on an even more stripped down bare AST package.)
Crucially, GHC itself would depend on these packages, so we maintain the abstraction boundary during GHC development, as opposed to crossing our fingers that this stuff separates cleanly at release time.
Thanks to @mpickering’s work on Multiple Home Units (!6805) · Merge requests · Glasgow Haskell Compiler / GHC · GitLab, we are well on the way to having a single GHCi (or HLS) session load multiple home units, so splitting ghc
in this way need not slow down GHC development.
Make template-haskell
use the regular AST
Currently template-haskell
has it’s own AST. This is bad because it is:
- Constantly as risk of falling behind GHC, not being able to represent new features
- Is generally a bit lossy/mismatched even when there isn’t new features
- Keeping both in sink is just a big time sink.
We should make it use the main AST, and thus avoid these problems
Process
I am thinking this can be “more of the same, with slight tweaks”. Basically as 24 is refined, hopefully accepted, and then tried out, we will learn what works and what doesn’t. Once we’re “over the hump” (we’ve made significant process converting errors, and we have our HLS proof of concept), we can could start this as a very similar project to build on that new experience, try out any tweaks we wish to make, and generally keep busy.
Unlike 24, projects like HLS and hlint already use ghc-lib-parser
so the basic idea is already validated and we don’t need new protypes. We just need to get this done and out of the 70% limbo it is currently in.
CC @alanz @int-index