Commit 22c4d60b authored by Herbert Valerio Riedel's avatar Herbert Valerio Riedel 🕺

Revert "Restore invariant in `Data (Ratio a)` instance"

This reverts commit 79b0d0e6
due to

  Compile failed (status 256) errors were:
  [1 of 2] Compiling A                ( A.hs, A.o )
  [2 of 2] Compiling Main             ( T4491.hs, T4491.o )
  T4491.hs:19:11:
    Illegal data constructor name: ‘%â€
    When splicing a TH expression: (GHC.Real.%) 11 2
    In the splice: $(dataToExpQ (const Nothing) (5.5 :: Rational))
  *** unexpected failure for T4491(normal)

Therefore re-opening #10011
parent 79b0d0e6
......@@ -1059,15 +1059,15 @@ instance Data Word64 where
------------------------------------------------------------------------------
ratioConstr :: Constr
ratioConstr = mkConstr ratioDataType "%" [] Infix
ratioConstr = mkConstr ratioDataType ":%" [] Infix
ratioDataType :: DataType
ratioDataType = mkDataType "GHC.Real.Ratio" [ratioConstr]
instance (Data a, Integral a) => Data (Ratio a) where
gfoldl k z (a :% b) = z (%) `k` a `k` b
instance Data a => Data (Ratio a) where
gfoldl k z (a :% b) = z (:%) `k` a `k` b
toConstr _ = ratioConstr
gunfold k z c | constrIndex c == 1 = k (k (z (%)))
gunfold k z c | constrIndex c == 1 = k (k (z (:%)))
gunfold _ _ _ = error "Data.Data.gunfold(Ratio)"
dataTypeOf _ = ratioDataType
......
......@@ -140,8 +140,6 @@
* Add `callocArray` and `callocArray0` to `Foreign.Marshal.Array`. (#9859)
* Restore invariant in `Data (Ratio a)` instance (#10011)
## 4.7.0.2 *Dec 2014*
* Bundled with GHC 7.8.4
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment