[GHC] #8582: Record syntax for pattern synonyms

GHC ghc-devs at haskell.org
Fri Oct 2 10:18:17 UTC 2015


#8582: Record syntax for pattern synonyms
-------------------------------------+-------------------------------------
        Reporter:  cactus            |                Owner:  mpickering
            Type:  feature request   |               Status:  new
        Priority:  high              |            Milestone:  8.0.1
       Component:  Compiler          |              Version:
      Resolution:                    |             Keywords:
                                     |  PatternSynonyms
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:  5144              |             Blocking:
 Related Tickets:                    |  Differential Rev(s):  Phab:D1152
-------------------------------------+-------------------------------------

Comment (by simonpj):

 Matthew, I feel bad about this but I still don't understand the
 ''specification''.  I honestly don't know what it means to say "a pattern
 synonym should behave like the relevant data constructor".  The
 [wiki:PatternSynonyms#Design wiki page] does not even give a syntax.  I
 think it may be something like this
 {{{
 patsyndecl ::=  'pattern' con var1 .. varn <- pat
              |  'pattern' con '{' var1 ',' ... ',' varn '}' <- pat
              | ... more for bidirectional ...
 }}}
 where the second line is the new bit.  Is that right?  Just writing out
 the syntax would be very helpful.

 We need semantics as well as syntax.  In comment:11 I tried to give some
 concrete pointers for what a specification might look like.  It has to say
  * What the syntax is
  * What it means to use such a pattern synonym as a constructor
  * What it means to match against such a synonym
 I don't think any of this is very hard to do.  But until it is done I
 don't know what the feature is, so it's hard to review the implementation.


 On the implementation front, I believe that you are stuck on a particular
 point.  There's a long comment stream on the Phab ticket so I'm not sure
 what you are stuck on.  Can you just identify the sticking point?

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


More information about the ghc-tickets mailing list