| Haskell Hierarchical Libraries (base package) | Contents | Index

GHC.Real

Portability | non-portable (GHC Extensions)
Stability | internal
Maintainer | cvs-ghc@haskell.org

Description
The types `Ratio` and `Rational`, and the classes `Real`, `Fractional`, `Integral`, and `RealFrac`.
Synopsis

data Ratio a = (:%) !a !a
type Rational = Ratio Integer
ratioPrec :: Int
ratioPrec1 :: Int
infinity :: Rational
notANumber :: Rational
(%) :: Integral a => a -> a -> Ratio a
numerator :: Integral a => Ratio a -> a
denominator :: Integral a => Ratio a -> a
reduce :: Integral a => a -> a -> Ratio a
class (Num a, Ord a) => Real a where

toRational :: a -> Rational

class (Real a, Enum a) => Integral a where

quot :: a -> a -> a
rem :: a -> a -> a
div :: a -> a -> a
mod :: a -> a -> a
quotRem :: a -> a -> (a, a)
divMod :: a -> a -> (a, a)
toInteger :: a -> Integer

class Num a => Fractional a where

(/) :: a -> a -> a
recip :: a -> a
fromRational :: Rational -> a

class (Real a, Fractional a) => RealFrac a where

properFraction :: Integral b => a -> (b, a)
truncate :: Integral b => a -> b
round :: Integral b => a -> b
ceiling :: Integral b => a -> b
floor :: Integral b => a -> b

numericEnumFrom :: Fractional a => a -> [a]
numericEnumFromThen :: Fractional a => a -> a -> [a]
numericEnumFromTo :: (Ord a, Fractional a) => a -> a -> [a]
numericEnumFromThenTo :: (Ord a, Fractional a) => a -> a -> a -> [a]
fromIntegral :: (Integral a, Num b) => a -> b
realToFrac :: (Real a, Fractional b) => a -> b
showSigned :: Real a => (a -> ShowS) -> Int -> a -> ShowS
even :: Integral a => a -> Bool
odd :: Integral a => a -> Bool
(^) :: (Num a, Integral b) => a -> b -> a
(^^) :: (Fractional a, Integral b) => a -> b -> a
gcd :: Integral a => a -> a -> a
lcm :: Integral a => a -> a -> a
integralEnumFrom :: (Integral a, Bounded a) => a -> [a]
integralEnumFromThen :: (Integral a, Bounded a) => a -> a -> [a]
integralEnumFromTo :: Integral a => a -> a -> [a]
integralEnumFromThenTo :: Integral a => a -> a -> a -> [a]

Documentation
data Ratio a

Constructors

(:%) !a !a |

Instances

Typeable a => Typeable (Ratio a)
(Integral a, Read a) => Read (Ratio a)
Integral a => Ord (Ratio a)
Integral a => Num (Ratio a)
Integral a => Fractional (Ratio a)
Integral a => Real (Ratio a)
Integral a => RealFrac (Ratio a)
Integral a => Show (Ratio a)
Integral a => Enum (Ratio a)
(Integral a, Eq a) => Eq (Ratio a)

type Rational = Ratio Integer
Arbitrary-precision rational numbers, represented as a ratio of two `Integer` values. A rational number may be constructed using the `%` operator.
ratioPrec :: Int
ratioPrec1 :: Int
infinity :: Rational
notANumber :: Rational
(%) :: Integral a => a -> a -> Ratio a
numerator :: Integral a => Ratio a -> a
denominator :: Integral a => Ratio a -> a
reduce :: Integral a => a -> a -> Ratio a
class (Num a, Ord a) => Real a where

Methods

toRational :: a -> Rational

Instances

Real CChar
Real CSChar
Real CUChar
Real CShort
Real CUShort
Real CInt
Real CUInt
Real CLong
Real CULong
Real CLLong
Real CULLong
Real CFloat
Real CDouble
Real CLDouble
Real CPtrdiff
Real CSize
Real CWchar
Real CSigAtomic
Real CClock
Real CTime
Real Float
Real Double
Real Int8
Real Int16
Real Int32
Real Int64
Real Int
Real Integer
Integral a => Real (Ratio a)
Real Word
Real Word8
Real Word16
Real Word32
Real Word64
Real CIno
Real CMode
Real COff
Real CPid
Real CSsize
Real CGid
Real CNlink
Real CUid
Real CTcflag
Real Fd

class (Real a, Enum a) => Integral a where

Methods

quot :: a -> a -> a
rem :: a -> a -> a
div :: a -> a -> a
mod :: a -> a -> a
quotRem :: a -> a -> (a, a)
divMod :: a -> a -> (a, a)
toInteger :: a -> Integer

Instances

Integral CChar
Integral CSChar
Integral CUChar
Integral CShort
Integral CUShort
Integral CInt
Integral CUInt
Integral CLong
Integral CULong
Integral CLLong
Integral CULLong
Integral CPtrdiff
Integral CSize
Integral CWchar
Integral CSigAtomic
Integral CClock
Integral CTime
Integral Int8
Integral Int16
Integral Int32
Integral Int64
Integral Int
Integral Integer
Integral Word
Integral Word8
Integral Word16
Integral Word32
Integral Word64
Integral CIno
Integral CMode
Integral COff
Integral CPid
Integral CSsize
Integral CGid
Integral CNlink
Integral CUid
Integral CTcflag
Integral Fd

class Num a => Fractional a where

Methods

(/) :: a -> a -> a
recip :: a -> a
fromRational :: Rational -> a

Instances

RealFloat a => Fractional (Complex a)
Fractional CFloat
Fractional CDouble
Fractional CLDouble
Fractional Float
Fractional Double
Integral a => Fractional (Ratio a)

class (Real a, Fractional a) => RealFrac a where

Methods

properFraction :: Integral b => a -> (b, a)
truncate :: Integral b => a -> b
round :: Integral b => a -> b
ceiling :: Integral b => a -> b
floor :: Integral b => a -> b

Instances

RealFrac CFloat
RealFrac CDouble
RealFrac CLDouble
RealFrac Float
RealFrac Double
Integral a => RealFrac (Ratio a)

numericEnumFrom :: Fractional a => a -> [a]
numericEnumFromThen :: Fractional a => a -> a -> [a]
numericEnumFromTo :: (Ord a, Fractional a) => a -> a -> [a]
numericEnumFromThenTo :: (Ord a, Fractional a) => a -> a -> a -> [a]
fromIntegral :: (Integral a, Num b) => a -> b
realToFrac :: (Real a, Fractional b) => a -> b
showSigned :: Real a => (a -> ShowS) -> Int -> a -> ShowS
even :: Integral a => a -> Bool
odd :: Integral a => a -> Bool
(^) :: (Num a, Integral b) => a -> b -> a
(^^) :: (Fractional a, Integral b) => a -> b -> a
gcd :: Integral a => a -> a -> a
lcm :: Integral a => a -> a -> a
integralEnumFrom :: (Integral a, Bounded a) => a -> [a]
integralEnumFromThen :: (Integral a, Bounded a) => a -> a -> [a]
integralEnumFromTo :: Integral a => a -> a -> [a]
integralEnumFromThenTo :: Integral a => a -> a -> a -> [a]
Produced by Haddock version 0.6