Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Rename Format to FPFormat.

  • Loading branch information...
commit 211dfaa559d0bb3b026b2bb6bb85b6f5e4c07e34 1 parent 9db7435
@bos authored
View
8 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.Types (Format(..))
+import Data.Text.Format.Types (FPFormat(..))
import qualified Data.Text as T
import Data.Array.Base (unsafeAt)
import Data.Text.Lazy.Builder
@@ -29,9 +29,9 @@ showFloat :: (RealFloat a) => a -> 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"
View
8 Data/Text/Format/RealFloat/Fast.hs
@@ -22,7 +22,7 @@ import Data.Text.Format.Functions ((<>), i2d)
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
@@ -119,9 +119,9 @@ fshowGFloat :: (DispFloat a) => Maybe Int -> a -> Builder
{-# 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"
View
10 Data/Text/Format/Types.hs
@@ -13,21 +13,21 @@
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
Please sign in to comment.
Something went wrong with that request. Please try again.