[GHC] #8761: Make pattern synonyms work with Template Haskell

GHC ghc-devs at haskell.org
Thu Oct 13 00:31:00 UTC 2016


#8761: Make pattern synonyms work with Template Haskell
-------------------------------------+-------------------------------------
        Reporter:  goldfire          |                Owner:  bollmann
            Type:  feature request   |               Status:  closed
        Priority:  normal            |            Milestone:  8.2.1
       Component:  Template Haskell  |              Version:  8.0.1
      Resolution:  fixed             |             Keywords:
                                     |  PatternSynonyms
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):  Phab:D1940
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by goldfire):

 Replying to [comment:27 heisenbug]:
 > Not sure how it is supposed to work, but can I somehow pass a name to be
 spliced into a pattern synonym quote?
 > {{{#!haskell
 > :t \n -> [d| pattern $(n) = 42 |]
 > }}}
 > errors out (unfortunately).

 No, I don't believe that's possible, because TH doesn't allow "name
 splices". You'd have to build up the syntax manually, using the `Dec`
 constructors or the functions from `Language.Haskell.TH.Lib`.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8761#comment:28>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list