[GHC] #10873: Bad error message for incorrect pattern synonym signature

GHC ghc-devs at haskell.org
Sat Sep 12 20:26:00 UTC 2015


#10873: Bad error message for incorrect pattern synonym signature
-------------------------------------+-------------------------------------
              Reporter:  mpickering  |             Owner:
                  Type:  bug         |            Status:  new
              Priority:  normal      |         Milestone:  8.0.1
             Component:  Compiler    |           Version:  7.10.2
  (Type checker)                     |
              Keywords:  newcomer    |  Operating System:  Unknown/Multiple
          Architecture:              |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
             Test Case:              |        Blocked By:
              Blocking:              |   Related Tickets:
Differential Revisions:              |
-------------------------------------+-------------------------------------
 Consider the following program

 {{{
 {-# LANGUAGE PatternSynonyms #-}

 pattern Pat :: Show a => () => a -> Maybe a
 pattern Pat a = Just a
 }}}

 GHC complains that

 {{{
 test.hs:4:9: No instance for (Show a) arising from a pattern
 }}}

 I think this is quite difficult to understand. The problem is that
 matching on `Just a` doesn't provide the show constraint (it provides no
 constraints). A better error message here would explain this fact and
 maybe a short explanation of the difference between prov/req in a pattern
 synonym signature.

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


More information about the ghc-tickets mailing list