Permalink
Browse files

Rename integral to decimal.

  • Loading branch information...
1 parent 9d95011 commit 61ff64275a819cc2c017e844e2b3dd861452aac3 @bos committed May 23, 2011
Showing with 36 additions and 36 deletions.
  1. +12 −12 Data/Text/Buildable.hs
  2. +3 −3 Data/Text/Format.hs
  3. +15 −15 Data/Text/Format/Int.hs
  4. +3 −3 Data/Text/Format/RealFloat.hs
  5. +3 −3 Data/Text/Format/RealFloat/Fast.hs
View
24 Data/Text/Buildable.hs
@@ -19,7 +19,7 @@ module Data.Text.Buildable
import Data.Int (Int8, Int16, Int32, Int64)
import Data.Ratio (Ratio, denominator, numerator)
import Data.Text.Format.Functions ((<>))
-import Data.Text.Format.Int (integral)
+import Data.Text.Format.Int (decimal)
import Data.Text.Format.RealFloat (formatRealFloat, showFloat)
import Data.Text.Format.RealFloat.Fast (DispFloat, formatFloat, fshowFloat)
import Data.Text.Format.Types (Fast(..), Shown(..))
@@ -57,47 +57,47 @@ instance Buildable [Char] where
{-# INLINE build #-}
instance Buildable Int8 where
- build = integral
+ build = decimal
{-# INLINE build #-}
instance Buildable Int16 where
- build = integral
+ build = decimal
{-# INLINE build #-}
instance Buildable Int32 where
- build = integral
+ build = decimal
{-# INLINE build #-}
instance Buildable Int where
- build = integral
+ build = decimal
{-# INLINE build #-}
instance Buildable Int64 where
- build = integral
+ build = decimal
{-# INLINE build #-}
instance Buildable Integer where
- build = integral
+ build = decimal
{-# INLINE build #-}
instance Buildable Word8 where
- build = integral
+ build = decimal
{-# INLINE build #-}
instance Buildable Word16 where
- build = integral
+ build = decimal
{-# INLINE build #-}
instance Buildable Word32 where
- build = integral
+ build = decimal
{-# INLINE build #-}
instance Buildable Word where
- build = integral
+ build = decimal
{-# INLINE build #-}
instance Buildable Word64 where
- build = integral
+ build = decimal
{-# INLINE build #-}
instance (Integral a, Buildable a) => Buildable (Ratio a) where
View
6 Data/Text/Format.hs
@@ -90,7 +90,7 @@ fixed :: (B.Buildable a, RealFloat a) =>
fixed decs = B.build . FPControl Fixed (Just decs)
-- ^ Render a floating point number using normal notation.
-fixed_ :: (B.Buildable a, RealFloat a) => -> a -> Builder
+fixed_ :: (B.Buildable a, RealFloat a) => a -> Builder
fixed_ = B.build . FPControl Fixed Nothing
-- ^ Render a floating point number using scientific/engineering
@@ -103,5 +103,5 @@ expt decs = B.build . FPControl Exponent (Just decs)
-- ^ Render a floating point number using scientific/engineering
-- notation (e.g. @2.3e123@).
-expt_ :: (B.Buildable a, RealFloat a) => -> a -> Builder
-expt_ decs = B.build . FPControl Exponent Nothing
+expt_ :: (B.Buildable a, RealFloat a) => a -> Builder
+expt_ = B.build . FPControl Exponent Nothing
View
30 Data/Text/Format/Int.hs
@@ -11,7 +11,7 @@
module Data.Text.Format.Int
(
- integral
+ decimal
, minus
) where
@@ -38,19 +38,19 @@ import GHC.Integer.GMP.Internals
# define PAIR(a,b) (a,b)
#endif
-integral :: Integral a => a -> Builder
-{-# SPECIALIZE integral :: Int -> Builder #-}
-{-# SPECIALIZE integral :: Int8 -> Builder #-}
-{-# SPECIALIZE integral :: Int16 -> Builder #-}
-{-# SPECIALIZE integral :: Int32 -> Builder #-}
-{-# SPECIALIZE integral :: Int64 -> Builder #-}
-{-# SPECIALIZE integral :: Word -> Builder #-}
-{-# SPECIALIZE integral :: Word8 -> Builder #-}
-{-# SPECIALIZE integral :: Word16 -> Builder #-}
-{-# SPECIALIZE integral :: Word32 -> Builder #-}
-{-# SPECIALIZE integral :: Word64 -> Builder #-}
-{-# RULES "integral/Integer" integral = integer :: Integer -> Builder #-}
-integral i
+decimal :: Integral a => a -> Builder
+{-# SPECIALIZE decimal :: Int -> Builder #-}
+{-# SPECIALIZE decimal :: Int8 -> Builder #-}
+{-# SPECIALIZE decimal :: Int16 -> Builder #-}
+{-# SPECIALIZE decimal :: Int32 -> Builder #-}
+{-# SPECIALIZE decimal :: Int64 -> Builder #-}
+{-# SPECIALIZE decimal :: Word -> Builder #-}
+{-# SPECIALIZE decimal :: Word8 -> Builder #-}
+{-# SPECIALIZE decimal :: Word16 -> Builder #-}
+{-# SPECIALIZE decimal :: Word32 -> Builder #-}
+{-# SPECIALIZE decimal :: Word64 -> Builder #-}
+{-# RULES "decimal/Integer" decimal = integer :: Integer -> Builder #-}
+decimal i
| i < 0 = minus <> go (-i)
| otherwise = go i
where
@@ -65,7 +65,7 @@ minus :: Builder
minus = singleton '-'
int :: Int -> Builder
-int = integral
+int = decimal
{-# INLINE int #-}
integer :: Integer -> Builder
View
6 Data/Text/Format/RealFloat.hs
@@ -15,7 +15,7 @@ module Data.Text.Format.RealFloat
import Data.Text.Format.Functions ((<>), i2d)
import Data.Text.Format.RealFloat.Functions (roundTo)
-import Data.Text.Format.Int (integral)
+import Data.Text.Format.Int (decimal)
import Data.Text.Format.Types.Internal (FPFormat(..))
import qualified Data.Text as T
import Data.Array.Base (unsafeAt)
@@ -48,7 +48,7 @@ formatRealFloat fmt decs x
Exponent ->
case decs of
Nothing ->
- let show_e' = integral (e-1) in
+ let show_e' = decimal (e-1) in
case ds of
"0" -> "0.0e0"
[d] -> singleton d <> ".0e" <> show_e'
@@ -63,7 +63,7 @@ formatRealFloat fmt decs x
(ei,is') = roundTo (dec'+1) is
(d:ds') = map i2d (if ei > 0 then init is' else is')
in
- singleton d <> singleton '.' <> fromString ds' <> singleton 'e' <> integral (e-1+ei)
+ singleton d <> singleton '.' <> fromString ds' <> singleton 'e' <> decimal (e-1+ei)
Fixed ->
let
mk0 ls = case ls of { "" -> "0" ; _ -> fromString ls}
View
6 Data/Text/Format/RealFloat/Fast.hs
@@ -20,7 +20,7 @@ module Data.Text.Format.RealFloat.Fast
) where
import Data.Text.Format.Functions ((<>), i2d)
-import Data.Text.Format.Int (integral)
+import Data.Text.Format.Int (decimal)
import Data.Text.Format.RealFloat.Fast.Internal (posToDigits)
import Data.Text.Format.RealFloat.Functions (roundTo)
import Data.Text.Format.Types.Internal (FPFormat(..))
@@ -142,7 +142,7 @@ formatFloat fmt decs x
Exponent ->
case decs of
Nothing ->
- let show_e' = integral $ if ei == 0 then (e-1) else e
+ let show_e' = decimal $ if ei == 0 then (e-1) else e
(ei,(d:ds)) = roundToS (decDigits x) is
in case is of
[0] -> "0.0e0"
@@ -153,7 +153,7 @@ formatFloat fmt decs x
[0] -> fromText "0." <> fromText (T.replicate dec' "0") <> "e0"
_ -> let (ei,is') = roundTo (dec'+1) is
(d:ds') = map i2d (if ei > 0 then init is' else is')
- in singleton d <> singleton '.' <> fromString ds' <> singleton 'e' <> integral (e-1+ei)
+ in singleton d <> singleton '.' <> fromString ds' <> singleton 'e' <> decimal (e-1+ei)
Fixed ->
let mk0 ls = case ls of { "" -> "0" ; _ -> fromString ls} in
case decs of

0 comments on commit 61ff642

Please sign in to comment.