Skip to content

Make StringPrimL take [Word8]

This is a follow-up of PHO's comment on #5218 (closed):


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.

Trac metadata
Trac field Value
Version 7.4.1
Type FeatureRequest
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Template Haskell
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information