[GHC] #16241: Avoid orphan instances with OVERLAPPABLE (sometimes)

GHC ghc-devs at haskell.org
Mon Jan 28 09:46:14 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 AntC):

 Ah, I see that I don't have orphan instances here, by the letter of the
 law:

 * `instance MyShow [a]` is declared in the same module as the class, so
 isn't an orphan;
 * `instance MyShow T` and `instance MyShow [T]` are declared in the same
 module as `data T`, so aren't orphans.

 Never the less, the problem is in the same ballpark as orphan instances:
 incoherence due to not all applicable instances being visible in all
 modules. Specifically, `instance MyShow [T]` is not visible in module
 `Help`, where constraint `MyShow [a] =>` on the signature for `showHelp`
 needs it. Then `OVERLAPPABLE` on `instance MyShow [a]` says 'beware! there
 are other instances in other scopes.'

 Is there a more accurate term or keyword I should use?

 ('orphan instance' seems to get bandied around on Stackoverflow in that
 more general sense.)

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/16241#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list