Exact-print info in the the HsSyn syntax tree

Simon Peyton Jones simon.peytonjones at gmail.com
Thu Jul 13 11:22:56 UTC 2023


Dear GHC developers

Could you please look at #23447 Where should "tokens" live
<https://gitlab.haskell.org/ghc/ghc/-/issues/23447>?

In brief, the question is whether we want to have:

data HsExpr p = ....
   | HsLet (XLet p) (HsLocalBinds p) (LHsExpr p)
or

data HsExpr p = ....
   | HsLet (XLet p) (HsToken "let" p)
           (HsLocalBinds p) (HsToken "in" p) (LHsExpr p)


In the former, if a client wants HsTokes to track the precise source
locations of the "let" and "in" keywords, they'd have to put it in the TTG
extension field; in the latter, this information is in *every* syntax tree.

At the moment we have some of each, which is not satisfactory. We need to
decide a policy and stick to it.  If you use HsSyn, HsExpr, HsPat etc, in
any way, you should have an opinion.  Please do express it. At the moment
we have only a few voices so we risk deciding without enough evidence and
use-cases.

Comments with specific use-cases and examples would be particularly helpful.

Thanks!

Simon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20230713/9421bb5d/attachment.html>


More information about the ghc-devs mailing list