Opened 2 years ago

Closed 2 years ago

#5618 closed bug (invalid)

TH cannot splice patterns in declaration quotes

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

Description

Try this:

{-# LANGUAGE TemplateHaskell #-}
module TH2 where
import Language.Haskell.TH

foo :: PatQ -> DecsQ
foo p = [d| $(p) = 1 |]

Or this

{-# LANGUAGE TemplateHaskell #-}
module TH3 where
import Language.Haskell.TH

foo :: PatQ -> DecsQ
foo p = [d| f $(p) = 1 |]

Change History (1)

comment:1 Changed 2 years ago by simonpj

  • Resolution set to invalid
  • Status changed from new to closed

Well to be fair the manual says explicitly "Note that pattern splices are not supported. " (http://www.haskell.org/ghc/docs/latest/html/users_guide/template-haskell.html).

But see my proposal for Template Haskell http://hackage.haskell.org/trac/ghc/blog/Template%20Haskell%20Proposal, which would support pattern splices. I totally lack cycles to act upon it.

Simon

Note: See TracTickets for help on using tickets.