Skip to content

Separate AST from GhcPass

One of the end-goals of TTG is a Haskell AST that can be used by GHC and other projects alike.

An impediment of this that the the TTG instances are in the same module as the data types which use the families. This means there is no way to even try to get a Haskell AST type without it's GHC-phase-specific ornaments. It would be good to separate:

  • Separate TTG type families from GhcPass / Pass, currently both are in GHC.Hs.Extension.
  • Separate AST data types from GHC-specific TTG type family instances, currently both are in the other GHC.Hs.* modules.

In the short term, I think this is best accomplished my baking more modules for just the AST types and families. Lots of helper functions are actually GhcPass-specific, (perhaps more than they need to be), but I wouldn't bother trying to deal with that at first as it leads to more complicated types / more type classes, which is controversial.

(This came up in the discussion of !1957 (closed), and also the mailing list on reducing the modules depended on by ghc-lib-parser)

CC @hsyl20

Edited by John Ericson
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information