@@ -86,6 +86,7 @@ import Data.Word (Word8, Word16, Word32, Word64)
86import Data.Version (Version, showVersion, parseVersion)
86import Data.Version (Version, showVersion, parseVersion)
87import Text.ParserCombinators.ReadP (readP_to_S)
87import Text.ParserCombinators.ReadP (readP_to_S)
88import Foreign.Storable (Storable)
88import Foreign.Storable (Storable)
89+import Numeric.Natural (Natural)
89import Prelude hiding (foldr)
90import Prelude hiding (foldr)
90import qualified Data.Aeson.Encode.Builder as E
91import qualified Data.Aeson.Encode.Builder as E
91import qualified Data.Aeson.Parser.Time as Time
92import qualified Data.Aeson.Parser.Time as Time
@@ -111,7 +112,6 @@ import qualified Data.Vector.Storable as VS
111import qualified Data.Vector.Unboxed as VU
112import qualified Data.Vector.Unboxed as VU
113#if MIN_VERSION_base(4,8,0)
114#if MIN_VERSION_base(4,8,0)
114−import Numeric.Natural
116import Control.Applicative ((<$>), (<*>), pure)
116import Control.Applicative ((<$>), (<*>), pure)
117import Data.Monoid (mempty)
117import Data.Monoid (mempty)
@@ -353,7 +353,6 @@ instance FromJSON Integer where
353 parseJSON = withScientific "Integral" $ pure . truncate
353 parseJSON = withScientific "Integral" $ pure . truncate
354 {-# INLINE parseJSON #-}
354 {-# INLINE parseJSON #-}
356−#if MIN_VERSION_base(4,8,0)
357instance ToJSON Natural where
356instance ToJSON Natural where
358 toJSON = toJSON . toInteger
357 toJSON = toJSON . toInteger
359 {-# INLINE toJSON #-}
358 {-# INLINE toJSON #-}
@@ -366,7 +365,6 @@ instance FromJSON Natural where
366 if Scientific.coefficient s < 0
365 if Scientific.coefficient s < 0
367 then fail $ "Expected a Natural number but got the negative number: " <> show s
366 then fail $ "Expected a Natural number but got the negative number: " <> show s
368 else pure $ truncate s
367 else pure $ truncate s
371instance ToJSON Int8 where
369instance ToJSON Int8 where
372 toJSON = Number . fromIntegral
370 toJSON = Number . fromIntegral