1. Bryan O'Sullivan
  2. aeson


jsgf  committed 124bfa6

Use toAscList for Sets to guarantee stable ordering

Plain Data.Set.toList doesn't seem to guarantee a order, and it would be
unfortunate to get different serializations of a Set depending on how
it was constructed.

  • Participants
  • Parent commits 382cf82
  • Branches default

Comments (0)

Files changed (1)

File Data/Aeson/Types.hs

View file
     {-# INLINE parseJSON #-}
 instance (ToJSON a) => ToJSON (Set.Set a) where
-    toJSON = toJSON . Set.toList
+    toJSON = toJSON . Set.toAscList
     {-# INLINE toJSON #-}
 instance (Ord a, FromJSON a) => FromJSON (Set.Set a) where