Trees that Grow / D3609

Alan & Kim Zimmerman alan.zimm at gmail.com
Mon Jun 5 18:30:08 UTC 2017


This is a heads up that D3609[1], the first step toward implementing Trees
that Grow[2] for the hsSyn AST is about to land in master.

The key change is that it is replacing the HsSyn type parameter with one
that is an index into a set of type families, enabling the extension points
(for a future diff).

Any current work in progress branches will need a one-time search and
replace of all type parameters as follows

RdrName  -> GhcPs
Name  -> GhcRs
Var -> GhcTc
Id -> GhcTcId


Any code that makes use of the GHC API and needs to compile with earlier
versions too can do something like

      #if MIN_VERSION_ghc(8,3,0)
      type ParseI     = GhcPs
      type RenameI    = GhcRn
      type TypecheckI = GhcTc
      #else
      type ParseI     = RdrName
      type RenameI    = Name
      type TypecheckI = Var
      #endif

and then replace the RdrName / Name / Var type params with ParseI / RenameI
/ TypecheckI.

A real world example is in ghc-exactprint[3]

Regards
  Alan

[1] https://phabricator.haskell.org/D3609
[2] https://ghc.haskell.org/trac/ghc/wiki/ImplementingTreesThatGrow
[3]
https://github.com/alanz/ghc-exactprint/commit/6a6e3cdeb40f9623e9a7fc6f1be90da981cb921b
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20170605/3982a045/attachment.html>


More information about the ghc-devs mailing list