Bryan O'Sullivan avatar Bryan O'Sullivan committed aa242cb

Rename integral to decimal.

Comments (0)

Files changed (5)

Data/Text/Buildable.hs

 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(..))
     {-# 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

Data/Text/Format.hs

 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
 
 -- ^ 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

Data/Text/Format/Int.hs

 
 module Data.Text.Format.Int
     (
-      integral
+      decimal
     , minus
     ) where
 
 # 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
 minus = singleton '-'
 
 int :: Int -> Builder
-int = integral
+int = decimal
 {-# INLINE int #-}
 
 integer :: Integer -> Builder

Data/Text/Format/RealFloat.hs

 
 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)
      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'
            (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}

Data/Text/Format/RealFloat/Fast.hs

     ) 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(..))
             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"
                     [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
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.