[GHC] #15814: Orphan Instance Overlap Error Message
GHC
ghc-devs at haskell.org
Tue Nov 27 11:20:08 UTC 2018
#15814: Orphan Instance Overlap Error Message
-------------------------------------+-------------------------------------
Reporter: parsonsmatt | Owner: (none)
Type: feature request | Status: patch
Priority: normal | Milestone:
Component: Compiler | Version: 8.4.3
Resolution: | Keywords: newcomer
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s): Phab:D5377
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by simonpj):
Thanks for working on this.
Indeed, a careful `Note` to explain how it works, and some more type
signatures on local definitions, would be helpful. I could not understand
the code.
I think your idea is something like this, supposing we are compiling
module M, and are reporting an instance whose dictionary function is
`$df`.
* Given a `$df` we know the module D in which it is defined, via
`nameModule`.
* If that module D is
* M itself, or
* one of the module that M directly imports
* an orphan module
we can report how `$df` came to be in scope.
* Those three cases are easy because we have that info to hand in the
`TcGblEnv`.
You code looks a bit complicated if I'm right, but maybe I'm missing
something.
I also wonder about doing the full job, when `$df` is in scope indirectly.
After all, that's the situation in which the user is going to be most
puzzled! What we want is to ask
* For each `import B`, does `B` transitively import `D`?
And that info is also conveniently available, in the `mi_deps` field of
each `ModIface`. So it should be easy to do to full job, no exceptions.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15814#comment:4>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list