on master help sign in
Import Encode.Builder as EB to prevent clashes
commit5a0faf747a4e38ad8b51474c775f350d5f91f166 authorOleg Grenrus <oleg.grenrus@iki.fi> dateFri 3 Jun 2016, 12:35 (10 years ago) parentbc3c834
1 file changed+18−18
Data/Aeson/Types/Instances.hs+18−18
Data/Aeson/Types/Instances.hs+18−18
@@ -120,7 +120,7 @@ import Text.ParserCombinators.ReadP (readP_to_S)
120120import Foreign.Storable (Storable)
121121import Numeric.Natural (Natural)
122122import Prelude hiding (foldr)
123−import qualified Data.Aeson.Encode.Builder as E
123+import qualified Data.Aeson.Encode.Builder as EB
124124import qualified Data.Aeson.Parser.Time as Time
125125import qualified Data.ByteString.Builder as B
126126import qualified Data.ByteString.Lazy as L
@@ -201,7 +201,7 @@ realFloatToJSON d
201201
202202realFloatToEncoding :: RealFloat a => a -> Encoding
203203realFloatToEncoding d
204− | isNaN d || isInfinite d = Encoding E.null_
204+ | isNaN d || isInfinite d = Encoding EB.null_
205205 | otherwise = toEncoding (Scientific.fromFloatDigits d)
206206{-# INLINE realFloatToEncoding #-}
207207
@@ -291,7 +291,7 @@ instance ToJSON1 Maybe where
291291 {-# INLINE liftToJSON #-}
292292
293293 liftToEncoding to _ (Just a) = to a
294− liftToEncoding _ _ Nothing = Encoding E.null_
294+ liftToEncoding _ _ Nothing = Encoding EB.null_
295295 {-# INLINE liftToEncoding #-}
296296
297297instance (ToJSON a) => ToJSON (Maybe a) where
@@ -369,7 +369,7 @@ instance ToJSON Bool where
369369 toJSON = Bool
370370 {-# INLINE toJSON #-}
371371
372− toEncoding = Encoding . E.bool
372+ toEncoding = Encoding . EB.bool
373373 {-# INLINE toEncoding #-}
374374
375375instance FromJSON Bool where
@@ -415,10 +415,10 @@ instance ToJSON Char where
415415 toJSONList = String . T.pack
416416 {-# INLINE toJSONList #-}
417417
418− toEncoding = Encoding . E.string . (:[])
418+ toEncoding = Encoding . EB.string . (:[])
419419 {-# INLINE toEncoding #-}
420420
421− toEncodingList = Encoding . E.string
421+ toEncodingList = Encoding . EB.string
422422 {-# INLINE toEncodingList #-}
423423
424424instance FromJSON Char where
@@ -490,7 +490,7 @@ instance HasResolution a => ToJSON (Fixed a) where
490490 toJSON = Number . realToFrac
491491 {-# INLINE toJSON #-}
492492
493− toEncoding = Encoding . E.number . realToFrac
493+ toEncoding = Encoding . EB.number . realToFrac
494494 {-# INLINE toEncoding #-}
495495
496496-- | /WARNING:/ Only parse fixed-precision numbers from trusted input
@@ -643,7 +643,7 @@ instance ToJSON Text where
643643 toJSON = String
644644 {-# INLINE toJSON #-}
645645
646− toEncoding = Encoding . E.text
646+ toEncoding = Encoding . EB.text
647647 {-# INLINE toEncoding #-}
648648
649649instance FromJSON Text where
@@ -656,7 +656,7 @@ instance ToJSON LT.Text where
656656
657657 toEncoding t = Encoding $
658658 B.char7 '"' <>
659− LT.foldrChunks (\x xs -> E.unquoted x <> xs) (B.char7 '"') t
659+ LT.foldrChunks (\x xs -> EB.unquoted x <> xs) (B.char7 '"') t
660660 {-# INLINE toEncoding #-}
661661
662662instance FromJSON LT.Text where
@@ -716,7 +716,7 @@ instance ToJSON Scientific where
716716 toJSON = Number
717717 {-# INLINE toJSON #-}
718718
719− toEncoding = Encoding . E.number
719+ toEncoding = Encoding . EB.number
720720 {-# INLINE toEncoding #-}
721721
722722instance FromJSON Scientific where
@@ -1047,7 +1047,7 @@ instance ToJSON Value where
10471047 toJSON a = a
10481048 {-# INLINE toJSON #-}
10491049
1050− toEncoding = Encoding . E.encodeToBuilder
1050+ toEncoding = Encoding . EB.encodeToBuilder
10511051 {-# INLINE toEncoding #-}
10521052
10531053instance FromJSON Value where
@@ -1078,21 +1078,21 @@ instance FromJSON DotNetTime where
10781078
10791079instance ToJSON Day where
10801080 toJSON = stringEncoding
1081− toEncoding z = Encoding (E.quote $ E.day z)
1081+ toEncoding z = Encoding (EB.quote $ EB.day z)
10821082
10831083instance FromJSON Day where
10841084 parseJSON = withText "Day" (Time.run Time.day)
10851085
10861086instance ToJSON TimeOfDay where
10871087 toJSON = stringEncoding
1088− toEncoding z = Encoding (E.quote $ E.timeOfDay z)
1088+ toEncoding z = Encoding (EB.quote $ EB.timeOfDay z)
10891089
10901090instance FromJSON TimeOfDay where
10911091 parseJSON = withText "TimeOfDay" (Time.run Time.timeOfDay)
10921092
10931093instance ToJSON LocalTime where
10941094 toJSON = stringEncoding
1095− toEncoding z = Encoding (E.quote $ E.localTime z)
1095+ toEncoding z = Encoding (EB.quote $ EB.localTime z)
10961096
10971097instance FromJSON LocalTime where
10981098 parseJSON = withText "LocalTime" (Time.run Time.localTime)
@@ -1100,7 +1100,7 @@ instance FromJSON LocalTime where
11001100instance ToJSON ZonedTime where
11011101 toJSON = stringEncoding
11021102
1103− toEncoding z = Encoding (E.quote $ E.zonedTime z)
1103+ toEncoding z = Encoding (EB.quote $ EB.zonedTime z)
11041104
11051105formatMillis :: (FormatTime t) => t -> String
11061106formatMillis = take 3 . formatTime defaultTimeLocale "%q"
@@ -1111,7 +1111,7 @@ instance FromJSON ZonedTime where
11111111instance ToJSON UTCTime where
11121112 toJSON = stringEncoding
11131113
1114− toEncoding t = Encoding (E.quote $ E.utcTime t)
1114+ toEncoding t = Encoding (EB.quote $ EB.utcTime t)
11151115
11161116-- | Encode something to a JSON string.
11171117--
@@ -1133,7 +1133,7 @@ instance ToJSON NominalDiffTime where
11331133 toJSON = Number . realToFrac
11341134 {-# INLINE toJSON #-}
11351135
1136− toEncoding = Encoding . E.number . realToFrac
1136+ toEncoding = Encoding . EB.number . realToFrac
11371137 {-# INLINE toEncoding #-}
11381138
11391139-- | /WARNING:/ Only parse lengths of time from trusted input
@@ -1224,7 +1224,7 @@ instance ToJSON (Proxy a) where
12241224 toJSON _ = Null
12251225 {-# INLINE toJSON #-}
12261226
1227− toEncoding _ = Encoding E.null_
1227+ toEncoding _ = Encoding EB.null_
12281228 {-# INLINE toEncoding #-}
12291229
12301230instance FromJSON (Proxy a) where