#5877: Make StringPrimL take [Word8]
------------------------------+---------------------------------------------
 Reporter:  reinerp           |          Owner:                  
     Type:  feature request   |         Status:  new             
 Priority:  normal            |      Component:  Template Haskell
  Version:  7.4.1             |       Keywords:                  
       Os:  Unknown/Multiple  |   Architecture:  Unknown/Multiple
  Failure:  None/Unknown      |       Testcase:                  
Blockedby:                    |       Blocking:                  
  Related:                    |  
------------------------------+---------------------------------------------
 This is a follow-up of
 [http://hackage.haskell.org/trac/ghc/ticket/5218#comment:12 PHO's comment]
 on #5218:


 ----
 What concerns me is that there seems no means of creating primitive byte-
 array literals with TH. That is, the  Lit type currently only has a
 constructor {{{StringPrimL String}}} which represents an {{{Addr#}}}
 literal encoded in UTF-8, thus {{{unsafePackAddressLen 3
 "\NUL\NUL\NUL"#}}} works but {{{unsafePackAddressLen 3 $(litE $
 StringPrimL "\NUL\NUL\NUL")}}} doesn't. So we probably need to make a
 change to the type of StringPrimL:

 {{{
 data Lit = CharL Char
          | StringL String
          | ...
          | StringPrimL [Word8] -- Raw, non-encoded "..."# literal.
 }}}

 ----

 I attach patches which implement this change.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5877>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to