Ticket #4168 (closed feature request: fixed)

Opened 3 years ago

Last modified 3 years ago

Add StringPrimL to template-haskell

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

Description

In designing a template haskell lexer, you cannot get the same performance as alex, due to the fact that you cannot encode a "string"# literal to house the lookup tables for the encoded lexer.

Proposal: add "string"# literals to template-haskell as StringPrimL (or another suitable constructor) to Lit.

Then the quasiquoter can emit a data type that contains Addr# references to the link-time-locatable "string"#s permitting constant folding and inlining away the particular link time choice of Addr#.

Change History

Changed 3 years ago by ekmett

  • cc ekmett@… added

Changed 3 years ago by ekmett

  • component changed from Compiler to Template Haskell

Changed 3 years ago by simonpj

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

Done. One patch for GHC:

Fri Jul 30 14:19:22 BST 2010  simonpj@microsoft.com
  * * Add StringPrimL as a constructor for Template Haskell (Trac #4168)
    
  There are already constructors for IntPrim, FloatPrim etc,
  so this makes it more uniform.
    
  There's a corresponding patch for the TH library

and one for the template-haskell library:

Fri Jul 30 14:15:50 BST 2010  simonpj@microsoft.com
  * Add a StringPrimL constructor to the Lit type (fix Trac #4168)
  
  There's a corresponding patch in the main compiler

It's all very simple and uniform, but I have not tested it thoroughly. Would you like to? Meanwhile I'll mark it as fixed.

Simon

Note: See TracTickets for help on using tickets.