[GHC] #16241: Avoid orphan instances with OVERLAPPABLE (sometimes)
GHC
ghc-devs at haskell.org
Mon Jan 28 11:57:08 UTC 2019
#16241: Avoid orphan instances with OVERLAPPABLE (sometimes)
-------------------------------------+-------------------------------------
Reporter: AntC | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.6.1
Resolution: | Keywords:
Operating System: Windows | Architecture:
Type of failure: Poor/confusing | Unknown/Multiple
error message | Test Case:
Blocked By: | Blocking:
Related Tickets: #15135 | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by simonpj):
> I think only if the instance is not marked OVERLAPPABLE
I'm not sure that's right. Currently
[http://downloads.haskell.org/~ghc/master/users-guide/glasgow_exts.html
#overlapping-instances the user manual for instance resolution] says this
{{{
Eliminate any candidate IX for which there is another candidate IY such
that both of the following hold:
* IY is strictly more specific than IX. That is, IY is a substitution
instance of IX but not vice versa.
* Either IX is overlappable, or IY is overlapping. (This “either/or”
design, rather than a “both/and” design, allow a client to
deliberately override an instance from a library, without requiring
a change to the library.)
}}}
The second bullet means that you don't need to say "OVERLAPPABLE" for an
instance to be overlappable. It's enough to say "OVERLAPPING" in the
overlapping instance. So you can't deduce anything much from the absence
of "OVERLAPPABLE", sadly.
I don't know if this is the right design. If we you could only overlap an
explicitly-overlappable instance, we could commit to them more
aggressively.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/16241#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list