on master help sign in
Merge pull request #265 from lfairy/truncate

Use `truncate` instead of `floor` in Integral instances

commit2618654675446ae729b638ab139e6fa72aacd5bb authorBryan O'Sullivan <bos@serpentine.com> dateMon 13 Jul 2015, 10:20 (11 years ago) parent2df2be2014ab56
1 file changed+2−2
Data/Aeson/Types/Instances.hs+2−2
Data/Aeson/Types/Instances.hs+2−2
@@ -311,7 +311,7 @@ instance ToJSON Integer where
311311-- specifying a scientific number with a big exponent like
312312-- @1e1000000000@.
313313instance FromJSON Integer where
314− parseJSON = withScientific "Integral" $ pure . floor
314+ parseJSON = withScientific "Integral" $ pure . truncate
315315 {-# INLINE parseJSON #-}
316316
317317instance ToJSON Int8 where
@@ -1614,5 +1614,5 @@ parseRealFloat expected v = typeMismatch expected v
16141614{-# INLINE parseRealFloat #-}
16151615
16161616parseIntegral :: Integral a => String -> Value -> Parser a
1617−parseIntegral expected = withScientific expected $ pure . floor
1617+parseIntegral expected = withScientific expected $ pure . truncate
16181618{-# INLINE parseIntegral #-}