Serge

That's odd. I've tried with both 7.6 and HEAD, and both fail on T_cubeext thus:
T_cubeext.hs:102:10:
    Overlapping instances for LinSolvRing (UPol k)
      arising from a use of `upEucRing'
    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 expression: upEucRing unA Map.empty
    In an equation for `dA': dA = upEucRing unA Map.empty

I am using ghc-7.6 from Dec 3 (ie *later* than the released GHC 7.6.1), so 
perhaps the difference in error message is due to a bug in 7.6.1 that's fixed 
in my version.  I suggest you use the 7.6.2 release candidate.

Anyway, the error message looks entirely legitimate.  It really does matter how 
'k' is instantiated!  I have no idea how it compiled before.

The solution is to add (EuclideanRing k) to the type sig of cubicExt.  Then it 
compiles all the way up to the top.

Simon

| -----Original Message-----
| From: glasgow-haskell-bugs-boun...@haskell.org [mailto:glasgow-haskell-
| bugs-boun...@haskell.org] On Behalf Of Serge D. Mechveliani
| Sent: 21 December 2012 18:46
| To: Simon Peyton-Jones
| Cc: glasgow-haskell-bugs@haskell.org
| Subject: Re: DoCon and GHC
| 
| On Fri, Dec 21, 2012 at 01:45:04PM +0000, Simon Peyton-Jones wrote:
| > OK, do this
| >
| > * {-# LANGUAGE ScopedTypeVariables, MonoLocalBinds #-}
| >
| > * import Categs( Domains1 )
| >
| > * Add type sig for dP'
| >     dP' :: (LinSolvRing (Pol a), CommutativeRing a) => Domains1 (Pol
| > a)
| >
| > Then it compiles.
| >
| > You are very close to the edge of what can be done!
| 
| 
| It works. Thank you.
| 
| There remains only a single unlucky module:  T_cubeext.
| The test  demotest/Main  works with exception of  T_cubeext, but I need
| T_cubeext.cubicExt  to work.
| 
| Please, continue the test with
| 
|   make install
|   cd demotest
|   ghc $doconCpOpt --make Main
| 
| (for  $doconCpOpt =
|   -fwarn-unused-matches -fwarn-unused-binds -fwarn-unused-imports
|   -fno-warn-overlapping-patterns -XRecordWildCards -XNamedFieldPuns
|   -XFlexibleContexts -XMultiParamTypeClasses -XUndecidableInstances
|   -XTypeSynonymInstances -XFlexibleInstances -XOverlappingInstances ).
| 
| It reports
| 
| ------------------------------------------------------------------
| ...
| T_cubeext.hs:102:20:
|     Could not deduce (k ~ k1)
|     from the context (Field k, FactorizationRing (UPol k))
|       bound by the type signature for
|                  cubicExt :: (Field k, FactorizationRing (UPol k)) =>
|                              k -> k -> Domains1 k -> (Domains1 (E k), [E
| k], k -> E k)
|       at T_cubeext.hs:(79,13)-(80,69)
|     or from (Field k1, FactorizationRing (UPol k1))
|       bound by the type signature for
|                  unA :: (Field k1, FactorizationRing (UPol k1)) => UPol
| k1
|       at T_cubeext.hs:101:9-56
|       `k' is a rigid type variable bound by
|           the type signature for
|             cubicExt :: (Field k, FactorizationRing (UPol k)) =>
|                         k -> k -> Domains1 k -> (Domains1 (E k), [E k],
| k -> E k)
|           at T_cubeext.hs:79:13
|       `k1' is a rigid type variable bound by
|            the type signature for
|              unA :: (Field k1, FactorizationRing (UPol k1)) => UPol k1
|            at T_cubeext.hs:101:9
|     Expected type: Domains1 k1
|       Actual type: Domains1 k
|     In the second argument of `cToUPol', namely `dK'
|     In the expression: cToUPol "d" dK unK
|     In an equation for `unA': unA = cToUPol "d" dK unK
| 
| T_cubeext.hs:105:7:
|     Overlapping instances for LinSolvRing (UPol k1)
|       arising from a use of `upEucRing'
|     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)) ...
| ------------------------------------------------------------------
| 
| I tried  {-# LANGUAGE ScopedTypeVariables, MonoLocalBinds #-}, and
| setting type signatures in various parts in  cubicExt.
| But this does not help.
| 
| There is another point. In
|          ``cubicExt :: (Field k, FactorizationRing (UPol k)) => ...''
| 
| the part       ``, FactorizationRing (UPol k)''                  (1)
| 
| was always considered as parasitic.  ghc-7.4.1  needs (1) to work, and
| at least  ghc-7.4.1  does compile the test.
| 
| I thought, may be, the future compilers will allow to omit this part.
| At least it is desirable for  ghc-7.6.2  to do the test in any variant,
| with (1) or without it.
| 
| Regards,
| 
| ------
| Sergei
| 
| _______________________________________________
| Glasgow-haskell-bugs mailing list
| Glasgow-haskell-bugs@haskell.org
| http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to