Re: [GHC] #14395: Redefining pattern synonym in GHCi triggers "‘p’ is untouchable" error
GHC
ghc-devs at haskell.org
Tue Nov 7 23:13:08 UTC 2017
#14395: Redefining pattern synonym in GHCi triggers "‘p’ is untouchable" error
-------------------------------------+-------------------------------------
Reporter: RyanGlScott | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler (Type | Version: 8.2.1
checker) | Keywords:
Resolution: | PatternSynonyms
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by simonpj):
The error message is indeed confusing, but I think what is happening is
this
* You load `Bug.hs`
* But the interactive context does not have `-XPatternSynonyms`
* So when you say
{{{
pattern Bar = Nothing
}}}
GHCi doesn't see `pattern` as a keyword; it sees it as a perfectly
ordinary identifier. So its' as if you had written
{{{
f Bar = Nothing
}}}
to define function `f`.
* That's why it says, for example
{{{
in an equation for ‘pattern’
}}}
Quite right! This is a function definition for function `pattern`.
It would be cool if it said "Perhaps you meant to use `PatternSynonuyms`"
but I don't really see where to put such a test.
Anyway I think it's a case of: not a bug, just a confusing error message.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14395#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list