Commits

basvandijk  committed d0db3bb

Add ToJSON and FromJSON instances for Scientific

  • Participants
  • Parent commits a01ba8a

Comments (0)

Files changed (1)

File Data/Aeson/Types/Instances.hs

                     else fail "Expected a string of length 1"
     {-# INLINE parseJSON #-}
 
+instance ToJSON Scientific where
+    toJSON = Number
+    {-# INLINE toJSON #-}
+
+instance FromJSON Scientific where
+    parseJSON = withScientific "Scientific" pure
+    {-# INLINE parseJSON #-}
+
 instance ToJSON Double where
     toJSON = realFloatToJSON
     {-# INLINE toJSON #-}