From: panne Date: Sun, 28 May 2000 20:45:45 +0000 (+0000) Subject: [project @ 2000-05-28 20:45:45 by panne] X-Git-Tag: Approximately_9120_patches~4361 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=33aaa8a620d2036d88ad78bd3cffcb62c43b6625;p=ghc-hetmet.git [project @ 2000-05-28 20:45:45 by panne] Rewrote RULES for gcd and lcm without forall. The old versions *did not* always fire because of a strange interaction with automatically generated specialisations for gcd! Example for this misbehaviour: main :: IO () main = do print (gcd 15675 156750 :: Integer) print (gcd 12345678987651075 156750 :: Integer) print (gcd 156750 12345678987651075 :: Integer) print (gcd 2469135797530215 12345678987651075 :: Integer) I don't understand why the new version works and the old one did not, so somebody else should probably have a look at this phenomenon. *please merge* (like all my commits in the last few days :-} --- diff --git a/ghc/lib/std/PrelReal.lhs b/ghc/lib/std/PrelReal.lhs index e6d64d5..06551b6 100644 --- a/ghc/lib/std/PrelReal.lhs +++ b/ghc/lib/std/PrelReal.lhs @@ -306,8 +306,8 @@ lcm x y = abs ((x `quot` (gcd x y)) * y) {-# RULES -"Int.gcd" forall a b . gcd a b = gcdInt a b -"Integer.gcd" forall a b . gcd a b = gcdInteger a b -"Integer.lcm" forall a b . lcm a b = lcmInteger a b +"gcd/Int->Int->Int" gcd = gcdInt +"gcd/Integer->Integer->Integer" gcd = gcdInteger +"lcm/Integer->Integer->Integer" lcm = lcmInteger #-} \end{code}