on master help sign in
Refactor the FromJSON instance of Fixed
commite5191ea52db25418552af0cb7d06dbde3d824a90 authorBas van Dijk <v.dijk.bas@gmail.com> dateWed 23 Oct 2013, 23:10 (13 years ago) parent1cb40a0
1 file changed+1−2
Data/Aeson/Types/Class.hs+1−2
Data/Aeson/Types/Class.hs+1−2
@@ -366,8 +366,7 @@ instance HasResolution a => ToJSON (Fixed a) where
366366 {-# INLINE toJSON #-}
367367
368368instance HasResolution a => FromJSON (Fixed a) where
369− parseJSON (Number s) = pure $ realToFrac s
370− parseJSON v = typeMismatch "Fixed" v
369+ parseJSON = withScientific "Fixed" $ pure . realToFrac
371370 {-# INLINE parseJSON #-}
372371
373372instance ToJSON Int where