Skip to content

Poor error message for unbound variable in pattern synonym

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]
Trac metadata
Trac field Value
Version 7.9
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information