Commits

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

Comments (0)

Files changed (1)

Data/Aeson/Types.hs

     {-# 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