RE: RdrName and decorations
I think it belongs in the HsSyn syntax tree. The RdrName for (say) Prelude.map is the same RdrName, whether or not it looks like `Prelude.map`. Simon From: ghc-devs [mailto:ghc-devs-boun...@haskell.org] On Behalf Of Alan & Kim Zimmerman Sent: 05 August 2016 14:40 To: ghc-devs@haskell.org Subject: RdrName and decorations Hi all At the moment I am working through ghc-exactprint, adding a feature to add standard API annotations to any constructed AST so that it can be (pretty)-printed. One of the major headaches is the decorations on a RdrName. What I mean by this is that an item appearing in the AST as a RdrName may have parens or backquotes around it, and may have a preceding keyword out of [forall, pattern, type]. I am slowly teasing out the contextual requirements to determine these, but it seems that they should be captured directly in the AST already. And not as API Annotations. So the question is, does it make sense to do this? Does it belong in the OccName or the RdrName if so? Alan ___ ghc-devs mailing list ghc-devs@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
Re: RdrName and decorations
I agree with you Alan. In particular, information about 'pattern' and 'type' keywords should be captured in the AST. It can be scrubbed out in the renamer to avoid polluting later passes. At the moment, the 'type' keyword doesn't do anything to direct the renaming process, it just resolves an ambiguity in parsing. Matt On Fri, Aug 5, 2016 at 2:40 PM, Alan & Kim Zimmerman <alan.z...@gmail.com> wrote: > Hi all > > At the moment I am working through ghc-exactprint, adding a feature to add > standard API annotations to any constructed AST so that it can be > (pretty)-printed. > > One of the major headaches is the decorations on a RdrName. > > What I mean by this is that an item appearing in the AST as a RdrName may > have parens or backquotes around it, and may have a preceding keyword out of > [forall, pattern, type]. > > I am slowly teasing out the contextual requirements to determine these, but > it seems that they should be captured directly in the AST already. And not > as API Annotations. > > So the question is, does it make sense to do this? Does it belong in the > OccName or the RdrName if so? > > > Alan > > > > ___ > ghc-devs mailing list > ghc-devs@haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs > ___ ghc-devs mailing list ghc-devs@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
RdrName and decorations
Hi all At the moment I am working through ghc-exactprint, adding a feature to add standard API annotations to any constructed AST so that it can be (pretty)-printed. One of the major headaches is the decorations on a RdrName. What I mean by this is that an item appearing in the AST as a RdrName may have parens or backquotes around it, and may have a preceding keyword out of [forall, pattern, type]. I am slowly teasing out the contextual requirements to determine these, but it seems that they should be captured directly in the AST already. And not as API Annotations. So the question is, does it make sense to do this? Does it belong in the OccName or the RdrName if so? Alan ___ ghc-devs mailing list ghc-devs@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs