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

GHC ghc-devs at haskell.org
Thu Aug 6 13:43:54 UTC 2015


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

Comment (by simonpj):

 OK.  I believe the "expect-broken" is because we get (odd-looking) error
 {{{
 T8968-1.hs:8:9: warning:
     Redundant constraint: Maybe a ~ Maybe a
     In the type signature for: C :: a -> X Maybe (Maybe a)
 }}}
 Now one of the minor changes in
 {{{
 commit 953648127cea2836ec134b03a966695ac0b36434
 Author: Simon Peyton Jones <simonpj at microsoft.com>
 Date:   Wed Aug 5 14:24:54 2015 +0100

     Tidy up and refactor wildcard handling
 }}}
 was to add a new `UserTypeCtxt` for pattern synonyms, namely `PatSynCtxt`.
 Previously I used `FunSigCtxt`.

 Then in `TcSimplify.warnRedundantGivens` I treat `PatSynCtxt` (like most
 others) as "do't report redundant constraints".  So the behaviour changes:
 redundant constraints are no longer reported for pattern synonyms.

 So, just remove the expect-broken; it's fine for them to pass.  I suppose
 that warning abour redundant constraints in pattern-synonym signatures
 might be a good thing, but that's a battle for another day.

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


More information about the ghc-tickets mailing list