From 3395f000e413381e155fceeadf0b9a8ea6e4b6b4 Mon Sep 17 00:00:00 2001 From: Simon Jakobi Date: Sat, 27 Sep 2025 13:25:52 +0200 Subject: [PATCH] Add disclaimer to D.HS.toList ...and improve the disclaimer for D.HM.toList. Fixes #481. --- Data/HashMap/Internal.hs | 5 +++-- Data/HashSet/Internal.hs | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Data/HashMap/Internal.hs b/Data/HashMap/Internal.hs index 2bb7029c..cbcff246 100644 --- a/Data/HashMap/Internal.hs +++ b/Data/HashMap/Internal.hs @@ -464,7 +464,7 @@ instance Ord k => Ord1 (HashMap k) where -- | The ordering is total and consistent with the `Eq` instance. However, -- nothing else about the ordering is specified, and it may change from --- version to version of either this package or of hashable. +-- version to version of either this package or of @hashable@. instance (Ord k, Ord v) => Ord (HashMap k v) where compare = cmp compare compare @@ -2224,7 +2224,8 @@ elems = List.map snd . toList -- ** Lists -- | \(O(n)\) Return a list of this map's elements. The list is --- produced lazily. The order of its elements is unspecified. +-- produced lazily. The order of its elements is unspecified, and it may +-- change from version to version of either this package or of @hashable@. toList :: HashMap k v -> [(k, v)] toList t = Exts.build (\ c z -> foldrWithKey (curry c) z t) {-# INLINE toList #-} diff --git a/Data/HashSet/Internal.hs b/Data/HashSet/Internal.hs index be1af480..143aefb8 100644 --- a/Data/HashSet/Internal.hs +++ b/Data/HashSet/Internal.hs @@ -439,7 +439,8 @@ filter p = HashSet . H.filterWithKey q . asMap {-# INLINE filter #-} -- | \(O(n)\) Return a list of this set's elements. The list is --- produced lazily. +-- produced lazily. The order of its elements is unspecified, and it may +-- change from version to version of either this package or of @hashable@. toList :: HashSet a -> [a] toList t = Exts.build (\ c z -> foldrWithKey (const . c) z (asMap t)) {-# INLINE toList #-}