ref: 5f55227a278a9959a5de95e0535177b3f57124d6
parent: 6ce8da5b4d9ce80140c512a4eb7a9711b2cb4e7f
author: Lennart Augustsson <lennart.augustsson@epicgames.com>
date: Sun Aug 18 15:49:53 EDT 2024
Add missing Real instance.
--- a/lib/Data/Ratio.hs
+++ b/lib/Data/Ratio.hs
@@ -16,6 +16,7 @@
import Data.Num
import Data.Ord
import Data.Ratio_Type
+import Data.Real
import Text.Show
{- in Data.Ratio_Type
@@ -70,6 +71,9 @@
showsPrec 8 x .
showString " % " .
showsPrec 8 y
+
+instance forall a . (Integral a, Ord a) => Real (Ratio a) where
+ toRational (x :% y) = toInteger x :% toInteger y
rationalInfinity :: Rational
rationalInfinity = 1 :% 0
--
⑨