[GHC] #15135: Overlapping typeclass instance selection depends on the optimisation level

GHC ghc-devs at haskell.org
Fri Oct 26 03:31:57 UTC 2018


#15135: Overlapping typeclass instance selection depends on the optimisation level
-------------------------------------+-------------------------------------
        Reporter:  nicuveo           |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:  8.8.1
       Component:  Compiler          |              Version:  8.4.2
      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 AntC):

 Replying to [comment:6 simonpj]:

 Thank you Simon for such a clear explanation. Oh dear!

 I see GHC has to do something like this under separate compilation. I'm
 not seeing why in a single module it doesn't at least inspect all
 instances in scope.

 >
 > Sadly, ''any'' instance declaration can be overlapped; GHC gives no way
 to say "this instance declaration cannot and must not be overlapped".
 This is terribly unsatisfactory, but at least we now understand what is
 going on.

 Then (?) we need a pragma for that, and it might need to be used in combo
 with other pragmas {-# OVERLAPPING, NOTOVERLAPPABLE #-}. Ugh!

 This'll get particularly ugh!ly if instances are in no substitution
 ordering. There's something to be said for statically validating all
 instances are in a strict substitution order.

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


More information about the ghc-tickets mailing list