[GHC] #14417: Overly specific instances may not be resolved

GHC ghc-devs at haskell.org
Fri Nov 3 18:17:54 UTC 2017


#14417: Overly specific instances may not be resolved
-------------------------------------+-------------------------------------
           Reporter:  dfeuer         |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:  8.4.1
          Component:  Compiler       |           Version:  8.3
  (Type checker)                     |
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  GHC rejects
  Unknown/Multiple                   |  valid program
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 {{{#!hs
 {-# LANGUAGE FlexibleInstances #-}
 {-# LANGUAGE UndecidableInstances #-}
 class A x
 class A x => B x
 class A x => C x
 instance B x => C x
 }}}

 produces

 {{{
 BrokenSuper.hs:8:10: error:
     • Could not deduce (A x)
         arising from the superclasses of an instance declaration
       from the context: B x
         bound by the instance declaration at BrokenSuper.hs:8:10-19
       Possible fix: add (A x) to the context of the instance declaration
     • In the instance declaration for ‘C x’
   |
 8 | instance B x => C x
 }}}

 This was noticed in [https://stackoverflow.com/questions/47093627/can-not-
 deduce-superclass this SO question] and reduced by Daniel Wagner.

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


More information about the ghc-tickets mailing list