Ticket #5877 (closed feature request: fixed)

Opened 15 months ago

Last modified 7 months ago

Make StringPrimL take [Word8]

Reported by: reinerp Owned by: igloo
Priority: normal Milestone: 7.6.1
Component: Template Haskell Version: 7.4.1
Keywords: Cc: pho@…
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets: 5218

Description

This is a follow-up of  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.

Attachments

ghc.patch Download (1.0 KB) - added by reinerp 15 months ago.
Patch for ghc
th.patch Download (3.0 KB) - added by reinerp 15 months ago.
Patch for Template Haskell
testsuite.patch Download (3.3 KB) - added by reinerp 15 months ago.
Patch for testsuite

Change History

Changed 15 months ago by reinerp

Patch for ghc

Changed 15 months ago by reinerp

Patch for Template Haskell

Changed 15 months ago by reinerp

Patch for testsuite

Changed 15 months ago by reinerp

  • status changed from new to patch

Changed 15 months ago by reinerp

  • owner set to reinerp
  • related set to 5218

Changed 15 months ago by reinerp

  • owner changed from reinerp to igloo

Changed 11 months ago by pcapriotti

  • difficulty set to Unknown
  • milestone set to 7.6.1

Changed 11 months ago by pcapriotti

  • status changed from patch to closed
  • resolution set to fixed

Merged to GHC HEAD:

commit ee44e19f20395596fc34f2bce5763fb16032dbd4
Author: Reiner Pope <reiner.pope@gmail.com>
Date:   Thu Feb 16 10:58:07 2012 +1100

    Template Haskell: StringPrimL now takes [Word8]

and template-haskell:

commit 82291b03b45b4a72ed98419e1893cd74c2e420ca
Author: Reiner Pope <reiner.pope@gmail.com>
Date:   Thu Feb 16 10:58:28 2012 +1100

    StringPrimL now takes [Word8]

Changed 7 months ago by PHO

  • cc pho@… added
Note: See TracTickets for help on using tickets.