
#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.9 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: D297 | -------------------------------------+------------------------------------- Comment (by alanz): There is one other issue required for source to source conversions, namely original literal values. When literals are parsed, they are converted into an internal representation, and the original string is discarded. I am proposing to amend `HsLit` to be {{{ #!haskell data HsLit = HsChar String Char -- Character | HsCharPrim String Char -- Unboxed character | HsString String FastString -- String | HsStringPrim String ByteString -- Packed bytes | HsInt String Integer -- Genuinely an Int; arises from -- TcGenDeriv, and from TRANSLATION | HsIntPrim String Integer -- literal Int# | HsWordPrim String Integer -- literal Word# | HsInt64Prim String Integer -- literal Int64# | HsWord64Prim String Integer -- literal Word64# | HsInteger String Integer Type -- Genuinely an integer; arises only from -- TRANSLATION (overloaded literals are -- done with HsOverLit) | HsRat String FractionalLit Type -- Genuinely a rational; arises only from -- TRANSLATION (overloaded literals are -- done with HsOverLit) | HsFloatPrim String FractionalLit -- Unboxed Float | HsDoublePrim String FractionalLit -- Unboxed Double deriving (Data, Typeable) }}} where the first parameter in each case is the original source code represetation of the literal. Should this be a `String` or a `FastString`? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9628#comment:28 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler