HORIZON HASKELLDocslts/ghc-10.0.x2b276322026-10-31Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 2b27632 · 2026-10-31

Modulebase-compat-0.15.0Haskell2010

Data.Ratio.Compat

Synopsis
valuedenominator :: Ratio a -> a

Extract the denominator of the ratio in reduced form: the numerator and denominator have no common factor and the denominator is positive.

valuenumerator :: Ratio a -> a

Extract the numerator of the ratio in reduced form: the numerator and denominator have no common factor and the denominator is positive.

datadata Ratio a

Rational numbers, with numerator and denominator of some Integral type.

Note that Ratio's instances inherit the deficiencies from the type parameter's. For example, Ratio Natural's Num instance has similar problems to Numeric.Natural.Natural's.

Instances12Lift, Enum, Eq, Fractional, Data, Num, …
typetype Rational = Ratio Integer

Arbitrary-precision rational numbers, represented as a ratio of two Integer values. A rational number may be constructed using the % operator.