Data instance for ratio changed, now incompatible
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:
-
fromConstr = fromConstrB undefinedin Data.Data is a really bad idea - instead of undefinederror "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 :-) -
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.
Trac metadata
| Trac field | Value |
|---|---|
| Version | 6.10.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |