[GHC] #5051: Typechecker behaviour change

GHC cvs-ghc at haskell.org
Sat Mar 26 18:57:58 CET 2011


#5051: Typechecker behaviour change
---------------------------------+------------------------------------------
    Reporter:  igloo             |        Owner:              
        Type:  bug               |       Status:  new         
    Priority:  normal            |    Milestone:              
   Component:  Compiler          |      Version:  7.0.2       
    Keywords:                    |     Testcase:              
   Blockedby:                    |   Difficulty:              
          Os:  Unknown/Multiple  |     Blocking:              
Architecture:  Unknown/Multiple  |      Failure:  None/Unknown
---------------------------------+------------------------------------------
 From: http://www.haskell.org/pipermail/glasgow-haskell-
 users/2011-March/020116.html

 The behaviour has changed (7.0.1 accepts it, 7.0.2 doesn't), but I'm not
 sure which behaviour is right.

 I've put a cut-down (but not standalone) version of the offending module
 below. I believe the relevant steps are then:

 {{{
 The ct application means we need an instance for:
       Cast (ResidueI (Pol (ResidueE (UPol k))))
                      (Pol (ResidueE (UPol k)))

 Need: Cast (ResidueI (Pol (ResidueE (UPol k))))
                      (Pol (ResidueE (UPol k)))
 Have:     instance LinSolvRing a => Cast (ResidueI a) a

 Now need: LinSolvRing (Pol (ResidueE (UPol k)))
 Have:     instance EuclideanRing a => LinSolvRing (Pol a)

 Now need: EuclideanRing (ResidueE (UPol k))
 Have:     instance (EuclideanRing a, Ring (ResidueE a) )
                 => EuclideanRing (ResidueE a)

 Now need: EuclideanRing (UPol k)
 Have:     instance Field a => EuclideanRing (UPol a)

 Now need: LinSolvRing (UPol k)    (from the EuclideanRing class
 constraints)
 Have:     instance EuclideanRing a => LinSolvRing (UPol a)  (Pol2_.hs:95)
 And:      instance (LinSolvRing (Pol a), CommutativeRing a)
                 => LinSolvRing (UPol (Pol a))

 A different instance should be used depending on whether or not
     k = Pol x
 (for some x).
 }}}

 With flags:
 {{{
 -XTypeSynonymInstances -XUndecidableInstances -XFlexibleContexts
 -XFlexibleInstances -XMultiParamTypeClasses -XOverlappingInstances
 -XRecordWildCards -XNamedFieldPuns -XScopedTypeVariables -fcontext-
 stack=30
 }}}

 {{{
 module T_cubeext (cubicExt) where

 import Prelude (undefined)
 import DPrelude (ct)
 import Categs (ResidueE)
 import SetGroup ()
 import RingModule (Field, FactorizationRing)
 import VecMatr  ()
 import Fraction ()
 import Pol (Pol, UPol)
 import Residue (ResidueI)
 import GBasis  ()

 cubicExt :: forall k . (Field k, FactorizationRing (UPol k))
          => k -> ()
 cubicExt _ = undefined
  where unE :: ResidueI (Pol (ResidueE (UPol k)))
        unE  = undefined

        kToE :: Pol (ResidueE (UPol k)) -> ResidueI (Pol (ResidueE (UPol
 k)))
        kToE = ct unE
 }}}

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



More information about the Glasgow-haskell-bugs mailing list