Skip to content

Commit

Permalink
Used realToFrac instead of toRational . fromRational.
Browse files Browse the repository at this point in the history
  • Loading branch information
Clark Gaebel committed Oct 25, 2012
1 parent 1034181 commit 3d4178f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Data/Aeson/Types/Class.hs
Original file line number Diff line number Diff line change
Expand Up @@ -307,12 +307,12 @@ instance FromJSON (Ratio Integer) where
{-# INLINE parseJSON #-}

instance HasResolution a => ToJSON (Fixed a) where
toJSON = Number . fromRational . toRational
toJSON = Number . realToFrac
{-# INLINE toJSON #-}

instance HasResolution a => FromJSON (Fixed a) where
parseJSON (Number n) = pure $ case n of
D d -> fromRational $ toRational d
D d -> realToFrac d
I i -> fromIntegral i
parseJSON v = typeMismatch "Fixed" v
{-# INLINE parseJSON #-}
Expand Down

0 comments on commit 3d4178f

Please sign in to comment.