Opened 7 months ago

Last modified 2 weeks ago

#12429 new bug

Pattern synonym parse error should recommend enabling extension

Reported by: agibiansky Owned by:
Priority: low Milestone:
Component: Compiler Version: 7.10.3
Keywords: PatternSynonyms, newcomer Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
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 (3)

comment:1 Changed 7 months ago by mpickering

Keywords: PatternSynonyms added; pattern synonym error messages removed

comment:2 Changed 7 months 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 2 weeks ago by mpickering

Keywords: newcomer added
Note: See TracTickets for help on using tickets.