• RyanGlScott's avatar
    Handle Char#, Addr# in TH quasiquoter (fixes #10620) · 2c9de9c9
    RyanGlScott authored
    DsMeta does not attempt to handle quasiquoted Char# or Addr# values,
    which causes expressions like `$([| 'a'# |])` or `$([| "abc"# |])` to
    with an `Exotic literal not (yet) handled by Template Haskell` error.
    To fix this, the API of `template-haskell` had to be changed so that
    now has an extra constructor `CharPrimL` (a `StringPrimL` constructor
    existed, but it wasn't used). In addition, `DsMeta` has to manipulate
    `CoreExpr`s directly that involve `Word8`s. In order to do this,
    `Word8` had
    to be added as a wired-in type to `TysWiredIn`.
    Actually converting from `HsCharPrim` and `HsStringPrim` to `CharPrimL`
    `StringPrimL`, respectively, is pretty straightforward after that, since
    both `HsCharPrim` and `CharPrimL` use `Char` internally, and
    uses a `ByteString` internally, which can easily be converted to
    which is what `StringPrimL` uses.
    Reviewers: goldfire, austin, simonpj, bgamari
    Reviewed By: simonpj, bgamari
    Subscribers: thomie
    Differential Revision: https://phabricator.haskell.org/D1054
    GHC Trac Issues: #10620
all.T 13.5 KB