[GHC] #16114: strange "instance .. => .. => .. where ..."
GHC
ghc-devs at haskell.org
Tue Jan 8 12:15:48 UTC 2019
#16114: strange "instance .. => .. => .. where ..."
-------------------------------------+-------------------------------------
Reporter: j.waldmann | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.6.3
Resolution: | Keywords:
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):
> Another option would be to re-investigate checkValidInstance
I don't think so. What I missed before is that ''the renamer needs to
know'' which class is involved so it has the right "parent" for lookups.
You can see this in the call to `getLHsInstDeclClass_maybe` in
`RnNames.getLocalNonValBinders`. And it is also the cause of this ticket,
because the instance got past the renamer only by remaming `(==)` not to
the `(==)` from the `Eq` class, but to a new unrelated top-level binder.
Yikes.
I think putting up with marginally less-cool errors may be a price we have
to pay.
Rather than "mal-formed" we could say
{{{
Class instances must be of the form
context => C ty1 .. tyn
where C is a class
}}}
or something more positive than "mal-formed".
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/16114#comment:5>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list