TTG hsSyn for Batch and Interactive Parsing

Alan & Kim Zimmerman alan.zimm at
Mon May 7 15:16:57 UTC 2018

I want to be able to run the GHC parser in one of two modes, batch which
functions as now, and interactive which will (eventually) be incremental.

In addition, the hsSyn AST for each will have different TTG[1] annotations,
so that it can better support IDE usage.

I think this can be done by changing the types in HsExtension to introduce
a 'Process'  type as follows

data Pass = Parsed Process | Renamed | Typechecked
         deriving (Data)

data Process = Batch | Interactive
  deriving (Show, Data)

We then rename the pass synonyms so that batch is the default

type GhcPs   = GhcPass ('Parsed 'Batch)
type GhcPsI  = GhcPass ('Parsed 'Interactive)

I have attached a simple proof of concept file, which emulates parsing and

Is this an appropriate approach to take?


[1] Trees That Grow
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ParserTypes.hs
Type: text/x-haskell
Size: 2250 bytes
Desc: not available
URL: <>

More information about the ghc-devs mailing list