[GHC] #10620: Primitive chars and strings aren't handled by Template Haskell's quasiquoter
#10620: Primitive chars and strings aren't handled by Template Haskell's quasiquoter -------------------------------------+------------------------------------- Reporter: | Owner: RyanGlScott RyanGlScott | Status: new Type: bug | Milestone: Priority: normal | Version: 7.10.1 Component: Template | Operating System: Unknown/Multiple Haskell | Type of failure: GHC rejects Keywords: | valid program Architecture: | Blocked By: Unknown/Multiple | Related Tickets: Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Currently, Template Haskell can't quasiquote {{{Char#}}} or {{{Addr#}}} values: {{{ $ ghci -XTemplateHaskell -XMagicHash GHCi, version 7.10.1: http://www.haskell.org/ghc/ :? for help λ> import Language.Haskell.TH λ> $([| 'a'# |]) <interactive>:3:6: Exotic literal not (yet) handled by Template Haskell 'a'# λ> $([| "a"# |]) <interactive>:4:6: Exotic literal not (yet) handled by Template Haskell "a"## }}} To fix this, we'd need to change the API of {{{template-haskell}}} a bit, since {{{Lit}}} has a {{{StringPrimL}}} but not a {{{CharPrimL}}} constructor. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10620> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10620: Primitive chars and strings aren't handled by Template Haskell's quasiquoter -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: Type: bug | RyanGlScott Priority: normal | Status: new Component: Template Haskell | Milestone: Resolution: | Version: 7.10.1 Operating System: Unknown/Multiple | Keywords: Type of failure: GHC rejects | Architecture: valid program | Unknown/Multiple Blocked By: | Test Case: Related Tickets: #4168, #5218, | Blocking: #5877, | Differential Revisions: Phab:D1054 -------------------------------------+------------------------------------- Changes (by RyanGlScott): * differential: => Phab:D1054 * related: => #4168, #5218, #5877, -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10620#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10620: Primitive chars and strings aren't handled by Template Haskell's quasiquoter -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: Type: bug | RyanGlScott Priority: normal | Status: new Component: Template Haskell | Milestone: Resolution: | Version: 7.10.1 Operating System: Unknown/Multiple | Keywords: Type of failure: GHC rejects | Architecture: valid program | Unknown/Multiple Blocked By: | Test Case: Related Tickets: #4168, #5218, | Blocking: #5877, | Differential Revisions: Phab:D1054 -------------------------------------+------------------------------------- Comment (by Ben Gamari <ben@…>): In [changeset:"2c9de9c9a3df8e855c883139b0cb2fd41801bd67/ghc"]: {{{ #!CommitTicketReference repository="ghc" revision="2c9de9c9a3df8e855c883139b0cb2fd41801bd67" Handle Char#, Addr# in TH quasiquoter (fixes #10620) DsMeta does not attempt to handle quasiquoted Char# or Addr# values, which causes expressions like `$([| 'a'# |])` or `$([| "abc"# |])` to fail 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 `Lit` now has an extra constructor `CharPrimL` (a `StringPrimL` constructor already 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` and `StringPrimL`, respectively, is pretty straightforward after that, since both `HsCharPrim` and `CharPrimL` use `Char` internally, and `HsStringPrim` uses a `ByteString` internally, which can easily be converted to `[Word8]`, 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 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10620#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10620: Primitive chars and strings aren't handled by Template Haskell's quasiquoter -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: | RyanGlScott Type: bug | Status: new Priority: normal | Milestone: 7.12.1 Component: Template Haskell | Version: 7.10.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: GHC rejects | Unknown/Multiple valid program | Test Case: th/T10620 Blocked By: | Blocking: Related Tickets: #4168, #5218, | Differential Revisions: Phab:D1054 #5877, | -------------------------------------+------------------------------------- Changes (by thomie): * testcase: => th/T10620 * milestone: => 7.12.1 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10620#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10620: Primitive chars and strings aren't handled by Template Haskell's quasiquoter -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: | RyanGlScott Type: bug | Status: closed Priority: normal | Milestone: 7.12.1 Component: Template Haskell | Version: 7.10.1 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: GHC rejects | Unknown/Multiple valid program | Test Case: th/T10620 Blocked By: | Blocking: Related Tickets: #4168, #5218, | Differential Revisions: Phab:D1054 #5877, | -------------------------------------+------------------------------------- Changes (by goldfire): * status: new => closed * resolution: => fixed Comment: This seems all set. Correct me if I'm wrong. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10620#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC