[GHC] #9953: Pattern synonyms don't work with GADTs

GHC ghc-devs at haskell.org
Mon Jan 5 21:37:05 UTC 2015


#9953: Pattern synonyms don't work with GADTs
-------------------------------------+-------------------------------------
        Reporter:  simonpj           |                   Owner:  cactus
            Type:  bug               |                  Status:  new
        Priority:  normal            |               Milestone:  7.10.1
       Component:  Compiler (Type    |                 Version:  7.10.1-rc1
  checker)                           |                Keywords:
      Resolution:                    |  PatternSynonyms
Operating System:  Unknown/Multiple  |            Architecture:
 Type of failure:  None/Unknown      |  Unknown/Multiple
      Blocked By:                    |               Test Case:
 Related Tickets:                    |                Blocking:
                                     |  Differential Revisions:
-------------------------------------+-------------------------------------

Comment (by simonpj):

 The inferred type of `C1` should be isomoprhic to the declared type of
 `C2`.  That is you should be able to declare `C2`'s type as
 {{{
 pattern C2 :: (t ~ Maybe a) => a -> X t
 }}}
 if you want.  Just as you can in a GADT declaration: the data constructor
 decl
 {{{
   C :: arg1 -> arg2 -> T (Maybe a)
 }}}
 is precisely equivalent to (i.e. indistinguishable from)
 {{{
   C :: (t ~ Maybe a) => arg1 -> arg2 -> T t
 }}}

 In the same way, you should be able to declare `C3`'s type as
 {{{
 pattern C3 :: (t ~ Maybe a) => (Eq a) => a -> X t
 }}}
 if you want.

 As discussed in #9954, `C3` is simply ill typed.

 Does that resolve it?

 Simon

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


More information about the ghc-tickets mailing list