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.
commit1aa35aad896433b1549a0fe27f53235aa7c72d02
authorJeremy Fitzhardinge <jeremy@goop.org>
dateWed 23 Feb 2011, 15:17 (16 years ago)
parent8011429
Data/Aeson/Types.hs+1−1
@@ -518,7 +518,7 @@ instance (FromJSON a) => FromJSON (Vector a) where
518518 {-# INLINE parseJSON #-}
519519
520520instance (ToJSON a) => ToJSON (Set.Set a) where
521− toJSON = toJSON . Set.toList
521+ toJSON = toJSON . Set.toAscList
522522 {-# INLINE toJSON #-}
523523
524524instance (Ord a, FromJSON a) => FromJSON (Set.Set a) where