#5218: Add unpackCStringLen# to create Strings from string literals
---------------------------------+------------------------------------------
Reporter: tibbe | Owner:
Type: feature request | Status: new
Priority: high | Milestone: 7.6.1
Component: Compiler | Version: 7.0.3
Keywords: | Os: Unknown/Multiple
Architecture: Unknown/Multiple | Failure: None/Unknown
Difficulty: | Testcase:
Blockedby: | Blocking:
Related: |
---------------------------------+------------------------------------------
Comment(by PHO):
I want both solutions too, especially the solution 1.
What concerns me is that there seems no means of creating primitive byte-
array literals with TH. That is, the
[http://hackage.haskell.org/packages/archive/template-
haskell/2.6.0.0/doc/html/Language-Haskell-TH-Syntax.html#t:Lit 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.
}}}
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5218#comment:12>
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