class (Real a, Enum a) => Integral a where
quot, rem :: a -> a -> a
div, mod :: a -> a -> a
quotRem, divMod :: a -> a -> (a,a)
toInteger :: a -> Integer
-- Minimal complete definition:
-- quotRem, toInteger
n `quot` d = q where (q,r) = quotRem n d
n `rem` d = r where (q,r) = quotRem n d
n `div` d = q where (q,r) = divMod n d
n `mod` d = r where (q,r) = divMod n d
divMod n d = if signum r == - signum d then (q-1, r+d) else qr
where qr@(q,r) = quotRem n d
instance Integral Int where
...
instance Integral Integer where
...
_____________________________________________
Related sites:
-
dotNet Slackers - Your latest resource for ASP.NET
-
Dotnet Spider - Outsourcing and Offshore software development in India
-
XML - Xselerator, XSL Editor, BizTalk Utilities, XML Tutorials, Learn XML
-
Planet Source Code - The largest public source code database on the Internet
|
|
|