#2782: Data instance for ratio changed, now incompatible
---------------------------------+------------------------------------------
Reporter: NeilMitchell | Owner:
Type: bug | Status: new
Priority: normal | Component: Compiler
Version: 6.10.1 | Severity: normal
Keywords: | Testcase:
Architecture: Unknown/Multiple | Os: Unknown/Multiple
---------------------------------+------------------------------------------
Using the following code:
{{{
import Data.Generics -- import Data.Data on 6.10
import Data.Ratio
-- data (Integral a) => Ratio a = !a :% !a deriving (Eq)
u = undefined :: Ratio Integer
ctr t = head $ dataTypeConstrs $ dataTypeOf t
ctr2 t = length $ gmapQ (const undefined) $ asTypeOf (fromConstr $ ctr t)
t
test = ctr2 u
}}}
Under GHC 6.8.2 I get the answer 0, under GHC 6.10.1 I get the answer
"undefined". Both are wrong, but at least the GHC 6.8.2 one works enough
for me to use it. So there are a couple of issues here:
1) {{{fromConstr = fromConstrB undefined}}} in Data.Data is a really bad
idea - instead of undefined {{{error "Data.Data.fromConstr"}}} would be a
million times better. It took 3 hours to even figure out what library was
causing the undefined in a 80 module program! base was not my first guess
:-)
2) Ratio used to have a workable fromConstr, now it doesn't. Before it
gave the wrong answer. It's all to do with the strictness annotations on
:%. The new version means I can't use Uniplate with Haskell Source Exts,
which is a really big shame. I have no idea what the fix is.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2782>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs