[GHC] #9803: Poor error message for unbound variable in pattern synonym

GHC ghc-devs at haskell.org
Sat Nov 15 22:08:21 UTC 2014


#9803: Poor error message for unbound variable in pattern synonym
-------------------------------------+-------------------------------------
       Reporter:  goldfire           |                   Owner:
           Type:  bug                |                  Status:  new
       Priority:  normal             |               Milestone:
      Component:  Compiler           |                 Version:  7.9
       Keywords:                     |        Operating System:
   Architecture:  Unknown/Multiple   |  Unknown/Multiple
     Difficulty:  Easy (less than 1  |         Type of failure:
  hour)                              |  None/Unknown
     Blocked By:                     |               Test Case:
Related Tickets:                     |                Blocking:
                                     |  Differential Revisions:
-------------------------------------+-------------------------------------
 When I say

 {{{
 pattern OneElt = [x]
 }}}

 I get

 {{{
     Right-hand side of bidirectional pattern synonym cannot be used as an
 expression
       [x]
 }}}

 I have two complaints with this error message:
 1. It's very unclear what's actually wrong with the pattern -- `[x]` looks
 like a perfectly fine expression, until I realize that `x` is unbound.
 2. The herald of the error is more than 80 characters (if you count the
 indentation) and wraps on my 80-character terminal. GHC tends to avoid
 this elsewhere, and so the wrapping is suboptimal.

 I would easily say that issue (1) is more important than issue (2).

 Perhaps this would be better:

 {{{
     Variable `x' is unbound in the bidirectional pattern synonym `OneElt':
       [x]
 }}}

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


More information about the ghc-tickets mailing list