Opened 3 years ago

Closed 3 years ago

#12429 closed bug (fixed)

Pattern synonym parse error should recommend enabling extension

Reported by: agibiansky Owned by: ruperthorlick
Priority: low Milestone: 8.2.1
Component: Compiler Version: 8.1
Keywords: PatternSynonyms, newcomer Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case: parser/should_fail/T12429
Blocked By: Blocking:
Related Tickets: Differential Rev(s): Phab:D3261
Wiki Page:


Currently, if you try to use pattern synonyms in a module without -XPatternSynonyms, you can get a very uninformative parse error. For example:

module X where
import Data.Text (pattern Y)
x = 3

Yields, when compiled on GHC 7.10,

test.hs:3:27: parse error on input "Y"

It would be helpful if in addition to the error, the message suggested to the user to enable the PatternSynonyms extension, as many other error messages already do.

Change History (7)

comment:1 Changed 3 years ago by mpickering

Keywords: PatternSynonyms added; pattern synonym error messages removed

comment:2 Changed 3 years ago by simonpj

That sounds very sensible and do-able. Would anyone like to offer a patch? We have precedents; e.g. a sensible error when people use forall without RankNTypes.


comment:3 Changed 3 years ago by mpickering

Keywords: newcomer added

comment:4 Changed 3 years ago by ruperthorlick

Owner: set to ruperthorlick
Test Case: parser/should_fail/T12429

comment:5 Changed 3 years ago by ruperthorlick

Differential Rev(s): Phab:D3261
Status: newpatch

comment:6 Changed 3 years ago by Ben Gamari <ben@…>

In 4b1f0721/ghc:

Add suggestion for PatternSynonyms parse error (fixes #12429)

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

Differential Revision:

comment:7 Changed 3 years ago by bgamari

Milestone: 8.2.1
Resolution: fixed
Status: patchclosed
Note: See TracTickets for help on using tickets.