Handling source locations in HsSyn via TTG
Simon Peyton Jones
simonpj at microsoft.com
Mon Oct 28 09:31:06 UTC 2019
Friends
As you know
* We are trying to use "Trees That Grow<https://gitlab.haskell.org/ghc/ghc/wikis/implementing-trees-that-grow>" (TTG) to move HsSyn towards a situation in which GHC is merely a client of a generic HsSyn data type that can be used by clients other than GHC.
* One sticking point has been the question of attaching source locations. We used to have a "ping-pong" style, in which very node is decorated with a source location, but that's a bit more awkward in TTG.
* This wiki page<https://gitlab.haskell.org/ghc/ghc/wikis/implementing-trees-that-grow/handling-source-locations> outlines some choices, while ticket #15495<https://gitlab.haskell.org/ghc/ghc/issues/15495> has a lot of discussion.
* HEAD embodies Solution A. But it has the disadvantage that the type system doesn't enforce locations to be present at all. That has undesirable consequences (eg ticket #17330<https://gitlab.haskell.org/ghc/ghc/issues/17330>)
* The proposal is to move to Solution D on that page; you can see how it plays out in MR !1970<https://gitlab.haskell.org/ghc/ghc/merge_requests/1970>.
* (I think Solutions B and C are non-starters by comparison.)
If you care, please check out the design and the MR. We can change later, of course, but doing so changes a lot of code, including client code, so we'd prefer not to.
Let's try to converge by the end of the week.
Thanks
Simon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20191028/f3895afb/attachment.html>
More information about the ghc-devs
mailing list