@@ -1,5 +1,5 @@
1module Dict (empty,singleton,insert,update
1module Dict (empty,singleton,insert,update
2− ,lookup,findWithDefault
2+ ,lookup,findWithDefault,equals
3 ,remove,member
3 ,remove,member
4 ,foldl,foldr,map
4 ,foldl,foldr,map
5 ,union,intersect,diff
5 ,union,intersect,diff
@@ -17,7 +17,7 @@ Insert, remove, and query operations all take *O(log n)* time.
17@docs empty, singleton, insert, update, remove
17@docs empty, singleton, insert, update, remove
20−@docs member, lookup, findWithDefault
20+@docs member, lookup, findWithDefault, equals
23@docs union, intersect, diff
23@docs union, intersect, diff
@@ -112,6 +112,18 @@ member : comparable -> Dict comparable v -> Bool
112-- Does t contain k?
112-- Does t contain k?
113member k t = isJust <| lookup k t
113member k t = isJust <| lookup k t
115+{-| Check if the contents of all keys and values are equal.
117+equals : Dict comparable v -> Dict comparable v -> Bool
121+ (x::xs,y::ys) -> x == y && go (xs,ys)
125+ go (toList a, toList b)
115ensureBlackRoot : Dict k v -> Dict k v
127ensureBlackRoot : Dict k v -> Dict k v
116ensureBlackRoot t =
128ensureBlackRoot t =
117 case t of
129 case t of