Pattern synonyms with non-conid/consym names give poor error messages
The following:
{-# LANGUAGE PatternSynonyms #-}
-- Correct: pattern P = ()
pattern p = ()
gives a rather unhelpful error message:
parse error on input ‘=’
Perhaps you need a 'let' in a 'do' block?
e.g. 'let x = 5' instead of 'x = 5'
Ideally, it should hint that the name of pattern should follow constructor identifier rules.
In the same vein, the following:
{-# LANGUAGE PatternSynonyms #-}
-- Correct: pattern (:+) = ()
pattern (+) = ()
currently gives:
error: parse error on input ‘+’
It should hint that the operator should begin with a :
.
Trac metadata
Trac field | Value |
---|---|
Version | 8.0.1 |
Type | FeatureRequest |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |