[GHC] #12515: Pattern synonyms with non-conid/consym names give poor error messages
GHC
ghc-devs at haskell.org
Mon Aug 22 01:52:40 UTC 2016
#12515: Pattern synonyms with non-conid/consym names give poor error messages
-------------------------------------+-------------------------------------
Reporter: pkmx | Owner:
Type: feature | Status: new
request |
Priority: normal | Milestone:
Component: Compiler | Version: 8.0.1
Keywords: | Operating System: Unknown/Multiple
Architecture: | Type of failure: Incorrect
Unknown/Multiple | warning at compile-time
Test Case: | Blocked By:
Blocking: | Related Tickets:
Differential Rev(s): | Wiki Page:
-------------------------------------+-------------------------------------
The following:
{{{#!hs
{-# 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:
{{{#!hs
{-# LANGUAGE PatternSynonyms #-}
-- Correct: pattern (:+) = ()
pattern (+) = ()
}}}
currently gives:
{{{
error: parse error on input ‘+’
}}}
It should hint that the operator should begin with a {{{:}}}.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12515>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list