Zahlbereichs-Typen und -Klassen

data Int ; data Int
data Ratio a = a :% a
type Rational = Ratio Integer
data Float ; data Double




class (Eq a, Show a) => Num a where
    (+), (-), (*) :: a -> a -> a
    fromInteger   :: Integer -> a
class (Num a) => Fractional a where
    (/) :: a -> a -> a
    fromRational :: Rational -> a
class Fractional a => Floating a where
    exp, log, sqrt :: a -> a



Johannes Waldmann 2004-11-30