
Dear GHC team, I am testing the 7.02 candidate of ghc-7.0.1.20110217 -- compiled from source, compiled by itself, on Debian Linux, i386-family. On my DoCon program, it reports the following. 1. It requires `-fcontext-stack=_' to increase a certain stack: ... [67 of 83] Compiling Pfact__ ( Pfact__.hs, dist/build/Pfact__.o ) [68 of 83] Compiling RsePol_ ( RsePol_.hs, dist/build/RsePol_.o ) RsePol_.hs:214:28: Context reduction stack overflow; size = 21 Use -fcontext-stack=N to increase stack size to N $dSet :: Set (UPol (ResidueE Integer)) $dAddSemigroup :: AddSemigroup (UPol (ResidueE Integer)) $dAddMonoid :: AddMonoid (UPol (ResidueE Integer)) ... $dCast :: Prelude_.Cast (ResidueE (UPol (Pfact__.RseUPolRse Integer))) (UPol (Pfact__.RseUPolRse Integer)) In the first argument of `(.)', namely `ct c1' In the expression: ct c1 . toOverK . resRepr In an equation for `toC': toC = ct c1 . toOverK . resRepr ------------------------------------------- So, I add -fcontext-stack=30 to the ghc-options line in docon.cabal. Which one is better at this point, 7.0.1 or 7.0.1.20110217 ? 2. Then, DoCon is built, and the commands cd demotest ghc $doconCpOpt -O -rtsopts --make Main need to `make' the DoCon test under the DoCon library. This reports [ 1 of 17] Compiling T_detinterp ( T_detinterp.hs, T_detinterp.o ) [ 2 of 17] Compiling T_sphGeo ( T_sphGeo.hs, T_sphGeo.o ) [ 3 of 17] Compiling T_cubeext ( T_cubeext.hs, T_cubeext.o ) T_cubeext.hs:143:9: Overlapping instances for LinSolvRing (UPol k) arising from a use of `ct' Matching instances: instance [overlap ok] EuclideanRing a => LinSolvRing (UPol a) -- Defined in docon-2.12:Pol2_ instance [overlap ok] (LinSolvRing (Pol a), CommutativeRing a) => LinSolvRing (UPol (Pol a)) -- Defined in docon-2.12:Pol3_ (The choice depends on the instantiation of `k' To pick the first instance above, use -XIncoherentInstances when compiling the other instance declarations) In the first argument of `(.)', namely `ct unE' In the expression: ct unE . kToB In an equation for `kToE': kToE = ct unE . kToB -------------------------------------------------------------------- This looks like a bug of the kind appeared in a couple of earlier GHC versions. ghc-7.0.1 is free of both of these effects. What is your opinion about this? http://www.botik.ru/pub/local/Mechveliani/ghcBugs/702candBug.zip is the archive with the project to make and run under ghc-7.0.1, and ghc-7.0.1.20110217 (follow install.txt). Regards, ----------------- Serge Mechveliani mechvel@botik.ru

Hi Serge,
[ 3 of 17] Compiling T_cubeext ( T_cubeext.hs, T_cubeext.o )
T_cubeext.hs:143:9: Overlapping instances for LinSolvRing (UPol k) arising from a use of `ct' Matching instances: instance [overlap ok] EuclideanRing a => LinSolvRing (UPol a) -- Defined in docon-2.12:Pol2_ instance [overlap ok] (LinSolvRing (Pol a), CommutativeRing a) => LinSolvRing (UPol (Pol a)) -- Defined in docon-2.12:Pol3_ (The choice depends on the instantiation of `k' To pick the first instance above, use -XIncoherentInstances when compiling the other instance declarations) In the first argument of `(.)', namely `ct unE' In the expression: ct unE . kToB In an equation for `kToE': kToE = ct unE . kToB
Thanks for the report. I've taken a look, but it'll need someone like Simon or Dimitrios to give a definitive answer as to which behaviour is right and which is wrong. 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). 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 Thanks Ian
participants (2)
-
Ian Lynagh
-
Serge D. Mechveliani