Commits

basvandijk committed 5d2b193

Use scientific >= 0.3.1

scientific-0.3.1 exports the Text and ByteString Scientific Builders from
the following modules respectively:

- Data.Text.Lazy.Builder.Scientific
- Data.ByteString.Builder.Scientific

Comments (0)

Files changed (3)

Data/Aeson/Encode.hs

 
 import Data.Aeson.Types (Value(..))
 import Data.Monoid (mappend)
-import Data.Scientific (Scientific, coefficient, base10Exponent, scientificBuilder)
+import Data.Scientific (Scientific, coefficient, base10Exponent)
 import Data.Text.Lazy.Builder
 import Data.Text.Lazy.Builder.Int (decimal)
+import Data.Text.Lazy.Builder.Scientific (scientificBuilder)
 import Numeric (showHex)
 import qualified Data.HashMap.Strict as H
 import qualified Data.Text as T

Data/Aeson/Encode/ByteString.hs

 import Prelude hiding (null)
 import Data.Aeson.Types (ToJSON(..), Value(..))
 import Data.Char (ord)
-import Data.Scientific (Scientific, coefficient, base10Exponent, formatScientific, FPFormat(Generic))
+import Data.Scientific (Scientific, coefficient, base10Exponent)
 import Data.Word (Word8)
 import Data.Monoid (mappend)
 import           Data.ByteString.Builder      as B
 import           Data.ByteString.Builder.Prim as BP
+import           Data.ByteString.Builder.Scientific (scientificBuilder)
 import qualified Data.ByteString.Lazy as L
 import qualified Data.HashMap.Strict as HMS
 import qualified Data.Text as T
 
 number :: Scientific -> Builder
 number s
-    | e < 0     = B.string8 $ formatScientific Generic Nothing s
+    | e < 0     = scientificBuilder s
     | otherwise = B.integerDec (coefficient s * 10 ^ e)
   where
     e = base10Exponent s
     hashable >= 1.1.2.0,
     mtl,
     old-locale,
-    scientific >= 0.2 && < 0.3,
+    scientific >= 0.3.1,
     syb,
     template-haskell >= 2.4,
     time,