[GHC] #11762: GHC 8 superclass chain constraint regression

GHC ghc-devs at haskell.org
Mon Mar 28 14:13:27 UTC 2016


#11762: GHC 8 superclass chain constraint regression
-------------------------------------+-------------------------------------
           Reporter:  _deepfire      |             Owner:
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.0.1-rc2
  (Type checker)                     |
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 It seems that GHC 8 regresses with regard to GHC 7.10, when it tries to
 satisfy the constraints, implied by instance context.

 The following does not build on GHC 8.0.1 RC2, but does on 7.10.3:

 {{{#!hs
 {-# LANGUAGE FlexibleInstances #-}
 {-# LANGUAGE UndecidableInstances #-}
 --{-# LANGUAGE UndecidableSuperClasses #-} -- this doesn't matter
 {-# LANGUAGE UnicodeSyntax #-}

 module Foo where

 class Super a
 class Super a ⇒ Left a
 class Super a ⇒ Right a
 instance (Left a) ⇒ Right a
 }}}

 the error being:

 > • Could not deduce (Super a)
 >     arising from the superclasses of an instance declaration
 >   from the context: Left a
 >     bound by the instance declaration
 >     at repro.hs:9:10-27
 >   Possible fix:
 >     add (Super a) to the context of the instance declaration
 > • In the instance declaration for ‘Right a’

 It also /roughly/ seems that https://phabricator.haskell.org/D1594
 could possibly be related.

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


More information about the ghc-tickets mailing list