[GHC] #8581: Add support for explicitly-bidirectional pattern synonyms

GHC ghc-devs at haskell.org
Mon Mar 30 23:11:27 UTC 2015


#8581: Add support for explicitly-bidirectional pattern synonyms
-------------------------------------+-------------------------------------
        Reporter:  cactus            |                   Owner:
            Type:  feature request   |                  Status:  new
        Priority:  normal            |               Milestone:  7.12.1
       Component:  Compiler          |                 Version:
      Resolution:                    |                Keywords:
Operating System:  Unknown/Multiple  |  PatternSynonyms
 Type of failure:  None/Unknown      |            Architecture:
      Blocked By:  5144              |  Unknown/Multiple
 Related Tickets:                    |               Test Case:
                                     |                Blocking:
                                     |  Differential Revisions:
-------------------------------------+-------------------------------------

Comment (by dmcclean):

 Is it true that support for this didn't make it into 7.10?

 That looks to be the case, although it also looks to be the case that it
 did sneak in to the documentation:

 https://downloads.haskell.org/~ghc/7.10.1/docs/html/users_guide/syntax-
 extns.html#pattern-synonyms

 But my attempt to use the bidirectional syntax:

 {{{
 {-# LANGUAGE PatternSynonyms #-}

 data AugmentedRational = Exact' Integer Rational
                        | Approximate (forall a.Floating a => a)

 pattern Exact z q <- Exact' z q where
  Exact z q | q == 0 = Exact' 0 0
            | otherwise = Exact' z q
 }}}

 is rejected with

 {{{
 parse error on input `where'
 }}}

 By contrast, the 7.8.4 docs don't list this syntax, see
 https://downloads.haskell.org/~ghc/7.8.4/docs/html/users_guide/syntax-
 extns.html#pattern-synonyms.

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


More information about the ghc-tickets mailing list