on master help sign in
Refactor the FromJSON instance of Fixed
e5191eaBas van Dijk
Data/Aeson/Types/Class.hs+1−2
@@ -366,8 +366,7 @@ instance HasResolution a => ToJSON (Fixed a) where
366 {-# INLINE toJSON #-}
366 {-# INLINE toJSON #-}
367
367
368instance HasResolution a => FromJSON (Fixed a) where
368instance HasResolution a => FromJSON (Fixed a) where
369− parseJSON (Number s) = pure $ realToFrac s
369+ parseJSON = withScientific "Fixed" $ pure . realToFrac
370− parseJSON v = typeMismatch "Fixed" v
371 {-# INLINE parseJSON #-}
370 {-# INLINE parseJSON #-}
372
371
373instance ToJSON Int where
372instance ToJSON Int where