HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Modulerebase-1.21.2Haskell2010

Rebase.Data.Ratio

  • 2 types
  • 4 values
  • Packagerebase-1.21.2
  • Exports6
  • LanguageHaskell2010
  • LicenceMIT
  • SourceReal.hs
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.

Instances17NFData1, Lift, Enum, Eq, Fractional, Data, …
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.

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.

value(%) :: Integral a => a -> a -> Ratio a
#

Forms the ratio of two integral numbers.