[GHC] #10653: PatternSynonyms should be imported/exported as part of the wildcard notation

GHC ghc-devs at haskell.org
Sun Sep 13 11:21:22 UTC 2015


#10653: PatternSynonyms should be imported/exported as part of the wildcard
notation
-------------------------------------+-------------------------------------
        Reporter:  gridaphobe        |                   Owner:  mpickering
            Type:  feature request   |                  Status:  new
        Priority:  high              |               Milestone:  8.0.1
       Component:  Compiler          |                 Version:  7.11
      Resolution:                    |                Keywords:  pattern
                                     |  synonyms
Operating System:  Unknown/Multiple  |            Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |               Test Case:
      Blocked By:                    |                Blocking:
 Related Tickets:                    |  Differential Revisions:
-------------------------------------+-------------------------------------

Comment (by mpickering):

 Reid,

 Your example is not a valid bidirectional synonym as the RHS contains a
 view pattern.

 You are right that such synonyms can exist though. Here is an example.

 {{{
 {-# LANGUAGE PatternSynonyms, ViewPatterns #-}
 module Foo where

 class C f where
   build :: a -> f a
   destruct :: f a -> a

 pattern P :: () => C f => a -> f a
 pattern P x <- (destruct -> x)
   where
     P x = build x
 }}}

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


More information about the ghc-tickets mailing list