[GHC] #9628: Add Annotations to the AST to simplify source to source conversions

GHC ghc-devs at haskell.org
Wed Sep 24 08:56:42 UTC 2014


#9628: Add Annotations to the AST to simplify source to source conversions
-------------------------------------+-------------------------------------
              Reporter:  alanz       |            Owner:  alanz
                  Type:  feature     |           Status:  new
  request                            |        Milestone:
              Priority:  normal      |          Version:  7.8.3
             Component:  Compiler    |         Keywords:
            Resolution:              |     Architecture:  Unknown/Multiple
      Operating System:              |       Difficulty:  Unknown
  Unknown/Multiple                   |       Blocked By:
       Type of failure:              |  Related Tickets:
  None/Unknown                       |
             Test Case:              |
              Blocking:              |
Differential Revisions:              |
-------------------------------------+-------------------------------------

Comment (by simonpj):

 Yes, that's right. Looks much nicer to me.  The syntax tree is ''already''
 heavily decorated with `SrcSpans`.  Just parameterise over that, and you
 can decorate with something else instead.

 An alternative would be to insist that there was ''always'' a `SrcSpan`,
 plus perhaps something else:
 {{{
 data GenLocated l e = L SrcSpan l e
 type Located e = GenLocated () e
 }}}
 That's tiresome because there are lots of `()` values, but does mean you
 can always find a `SrcSpan`.  One would have to explore use cases.

 Simon

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9628#comment:5>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list