Commits

basvandijk committed d8c3db9

Nicer ToJSON instance from Number and Integer

  • Participants
  • Parent commits c12e932

Comments (0)

Files changed (1)

File Data/Aeson/Types/Instances.hs

 
 instance ToJSON Number where
     toJSON (D d) = toJSON d
-    toJSON (I i) = Number $ fromInteger i
+    toJSON (I i) = toJSON i
     {-# INLINE toJSON #-}
 
 instance FromJSON Number where
 {-# INLINE parseIntegral #-}
 
 instance ToJSON Integer where
-    toJSON = Number . fromIntegral
+    toJSON = Number . fromInteger
     {-# INLINE toJSON #-}
 
 instance FromJSON Integer where