summaryrefslogtreecommitdiff
path: root/libraries/base/Numeric.hs
diff options
context:
space:
mode:
authorDon Stewart <dons@galois.com>2008-02-28 18:54:09 +0000
committerDon Stewart <dons@galois.com>2008-02-28 18:54:09 +0000
commitdd53a7937002b43a1c8bc2201121af12bc7377a4 (patch)
tree78db6335c4660887dc3a34e4530c95bdc80ea558 /libraries/base/Numeric.hs
parent75d9ecb232a17270709f169f8f17f3ce3dbf4e79 (diff)
downloadhaskell-dd53a7937002b43a1c8bc2201121af12bc7377a4.tar.gz
untabify
Diffstat (limited to 'libraries/base/Numeric.hs')
-rw-r--r--libraries/base/Numeric.hs84
1 files changed, 42 insertions, 42 deletions
diff --git a/libraries/base/Numeric.hs b/libraries/base/Numeric.hs
index e24803e9e4..4868a8de68 100644
--- a/libraries/base/Numeric.hs
+++ b/libraries/base/Numeric.hs
@@ -16,45 +16,45 @@
module Numeric (
- -- * Showing
+ -- * Showing
- showSigned, -- :: (Real a) => (a -> ShowS) -> Int -> a -> ShowS
+ showSigned, -- :: (Real a) => (a -> ShowS) -> Int -> a -> ShowS
showIntAtBase, -- :: Integral a => a -> (a -> Char) -> a -> ShowS
- showInt, -- :: Integral a => a -> ShowS
+ showInt, -- :: Integral a => a -> ShowS
showHex, -- :: Integral a => a -> ShowS
showOct, -- :: Integral a => a -> ShowS
- showEFloat, -- :: (RealFloat a) => Maybe Int -> a -> ShowS
- showFFloat, -- :: (RealFloat a) => Maybe Int -> a -> ShowS
- showGFloat, -- :: (RealFloat a) => Maybe Int -> a -> ShowS
- showFloat, -- :: (RealFloat a) => a -> ShowS
+ showEFloat, -- :: (RealFloat a) => Maybe Int -> a -> ShowS
+ showFFloat, -- :: (RealFloat a) => Maybe Int -> a -> ShowS
+ showGFloat, -- :: (RealFloat a) => Maybe Int -> a -> ShowS
+ showFloat, -- :: (RealFloat a) => a -> ShowS
- floatToDigits, -- :: (RealFloat a) => Integer -> a -> ([Int], Int)
+ floatToDigits, -- :: (RealFloat a) => Integer -> a -> ([Int], Int)
- -- * Reading
+ -- * Reading
- -- | /NB:/ 'readInt' is the \'dual\' of 'showIntAtBase',
- -- and 'readDec' is the \`dual\' of 'showInt'.
- -- The inconsistent naming is a historical accident.
+ -- | /NB:/ 'readInt' is the \'dual\' of 'showIntAtBase',
+ -- and 'readDec' is the \`dual\' of 'showInt'.
+ -- The inconsistent naming is a historical accident.
- readSigned, -- :: (Real a) => ReadS a -> ReadS a
+ readSigned, -- :: (Real a) => ReadS a -> ReadS a
- readInt, -- :: (Integral a) => a -> (Char -> Bool)
- -- -> (Char -> Int) -> ReadS a
- readDec, -- :: (Integral a) => ReadS a
- readOct, -- :: (Integral a) => ReadS a
- readHex, -- :: (Integral a) => ReadS a
+ readInt, -- :: (Integral a) => a -> (Char -> Bool)
+ -- -> (Char -> Int) -> ReadS a
+ readDec, -- :: (Integral a) => ReadS a
+ readOct, -- :: (Integral a) => ReadS a
+ readHex, -- :: (Integral a) => ReadS a
- readFloat, -- :: (RealFloat a) => ReadS a
-
- lexDigits, -- :: ReadS String
+ readFloat, -- :: (RealFloat a) => ReadS a
+
+ lexDigits, -- :: ReadS String
- -- * Miscellaneous
+ -- * Miscellaneous
fromRat, -- :: (RealFloat a) => Rational -> a
- ) where
+ ) where
#ifdef __GLASGOW_HASKELL__
import GHC.Base
@@ -81,9 +81,9 @@ import Hugs.Numeric
-- | Reads an /unsigned/ 'Integral' value in an arbitrary base.
readInt :: Num a
- => a -- ^ the base
- -> (Char -> Bool) -- ^ a predicate distinguishing valid digits in this base
- -> (Char -> Int) -- ^ a function converting a valid digit character to an 'Int'
+ => a -- ^ the base
+ -> (Char -> Bool) -- ^ a predicate distinguishing valid digits in this base
+ -> (Char -> Int) -- ^ a function converting a valid digit character to an 'Int'
-> ReadS a
readInt base isDigit valDigit = readP_to_S (L.readIntP base isDigit valDigit)
@@ -120,15 +120,15 @@ readFloatP =
-- | Reads a /signed/ 'Real' value, given a reader for an unsigned value.
readSigned :: (Real a) => ReadS a -> ReadS a
readSigned readPos = readParen False read'
- where read' r = read'' r ++
- (do
- ("-",s) <- lex r
- (x,t) <- read'' s
- return (-x,t))
- read'' r = do
- (str,s) <- lex r
- (n,"") <- readPos str
- return (n,s)
+ where read' r = read'' r ++
+ (do
+ ("-",s) <- lex r
+ (x,t) <- read'' s
+ return (-x,t))
+ read'' r = do
+ (str,s) <- lex r
+ (n,"") <- readPos str
+ return (n,s)
-- -----------------------------------------------------------------------------
-- Showing
@@ -152,14 +152,14 @@ showInt n cs
-- mutual module deps.
{-# SPECIALIZE showEFloat ::
- Maybe Int -> Float -> ShowS,
- Maybe Int -> Double -> ShowS #-}
+ Maybe Int -> Float -> ShowS,
+ Maybe Int -> Double -> ShowS #-}
{-# SPECIALIZE showFFloat ::
- Maybe Int -> Float -> ShowS,
- Maybe Int -> Double -> ShowS #-}
+ Maybe Int -> Float -> ShowS,
+ Maybe Int -> Double -> ShowS #-}
{-# SPECIALIZE showGFloat ::
- Maybe Int -> Float -> ShowS,
- Maybe Int -> Double -> ShowS #-}
+ Maybe Int -> Float -> ShowS,
+ Maybe Int -> Double -> ShowS #-}
-- | Show a signed 'RealFloat' value
-- using scientific (exponential) notation (e.g. @2.45e2@, @1.5e-3@).
@@ -205,7 +205,7 @@ showIntAtBase base toChr n r
showIt (n,d) r = seq c $ -- stricter than necessary
case n of
0 -> r'
- _ -> showIt (quotRem n base) r'
+ _ -> showIt (quotRem n base) r'
where
c = toChr (fromIntegral d)
r' = c : r