Commits

Bryan O'Sullivan committed 6dd06b5

Rename Format to FPFormat.

  • Participants
  • Parent commits 55eb9b5

Comments (0)

Files changed (3)

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.Types (Format(..))
+import Data.Text.Format.Types (FPFormat(..))
 import qualified Data.Text as T
 import Data.Array.Base (unsafeAt)
 import Data.Text.Lazy.Builder
 {-# SPECIALIZE showFloat :: Double -> Builder #-}
 showFloat x = formatRealFloat Generic Nothing x
 
-formatRealFloat :: (RealFloat a) => Format -> Maybe Int -> a -> Builder
-{-# SPECIALIZE formatRealFloat :: Format -> Maybe Int -> Float -> Builder #-}
-{-# SPECIALIZE formatRealFloat :: Format -> Maybe Int -> Double -> Builder #-}
+formatRealFloat :: (RealFloat a) => FPFormat -> Maybe Int -> a -> Builder
+{-# SPECIALIZE formatRealFloat :: FPFormat -> Maybe Int -> Float -> Builder #-}
+{-# SPECIALIZE formatRealFloat :: FPFormat -> Maybe Int -> Double -> Builder #-}
 formatRealFloat fmt decs x
    | isNaN x                   = "NaN"
    | isInfinite x              = if x < 0 then "-Infinity" else "Infinity"

Data/Text/Format/RealFloat/Fast.hs

 import Data.Text.Format.Int (integral)
 import Data.Text.Format.RealFloat.Fast.Internal (posToDigits)
 import Data.Text.Format.RealFloat.Functions (roundTo)
-import Data.Text.Format.Types (Format(..))
+import Data.Text.Format.Types (FPFormat(..))
 import Data.Text.Lazy.Builder
 import qualified Data.Text as T
 
 {-# SPECIALIZE fshowGFloat :: Maybe Int -> Double -> Builder #-}
 fshowGFloat d x =  formatFloat Generic d x
 
-formatFloat :: DispFloat a => Format -> Maybe Int -> a -> Builder
-{-# SPECIALIZE formatFloat :: Format -> Maybe Int -> Float -> Builder #-}
-{-# SPECIALIZE formatFloat :: Format -> Maybe Int -> Double -> Builder #-}
+formatFloat :: DispFloat a => FPFormat -> Maybe Int -> a -> Builder
+{-# SPECIALIZE formatFloat :: FPFormat -> Maybe Int -> Float -> Builder #-}
+{-# SPECIALIZE formatFloat :: FPFormat -> Maybe Int -> Double -> Builder #-}
 formatFloat fmt decs x
     | isNaN x                   = "NaN"
     | isInfinite x              = if x < 0 then "-Infinity" else "Infinity"

Data/Text/Format/Types.hs

 
 module Data.Text.Format.Types
     (
-      Format(..)
+      FPFormat(..)
     , Fast(..)
     , Only(..)
     , Shown(..)
     ) where
 
 -- | Control the rendering of floating point numbers.
-data Format = Exponent
+data FPFormat = Exponent
               -- ^ Scientific notation (e.g. @2.3e123@).
-            | Fixed
+              | Fixed
               -- ^ Standard decimal notation.
-            | Generic
+              | Generic
               -- ^ Use decimal notation for values between @0.1@ and
               -- @9,999,999@, and scientific notation otherwise.
-            deriving (Enum, Read, Show)
+                deriving (Enum, Read, Show)
 
 -- | Render a floating point number using a much faster algorithm than
 -- the default (up to 10x faster). This performance comes with a