mirror of
https://github.com/digital-asset/daml.git
synced 2024-09-20 09:17:43 +03:00
Improve documentation for DA.TextMap.merge and DA.Next.Map.merge (#902)
Leave an explanation of what the functions is actually doing.
This commit is contained in:
parent
0ebdcb961e
commit
4df1ccfa13
@ -132,6 +132,10 @@ insert k v (Map t) = Map $ TextMap.insert (keyToText k) v t
|
||||
union : MapKey k => Map k v -> Map k v -> Map k v
|
||||
union (Map t1) (Map t2) = Map $ TextMap.union t1 t2
|
||||
|
||||
-- | Merge two maps. `merge f g h x y` applies `f` to all key/value pairs
|
||||
-- whose key only appears in `x`, `g` to all pairs whose key only appears
|
||||
-- in `y` and `h` to all pairs whose key appears in both `x` and `y`.
|
||||
-- In the end, all pairs yielding `Some` are collected as the result.
|
||||
merge
|
||||
: MapKey k
|
||||
=> (k -> a -> Optional c)
|
||||
|
@ -98,7 +98,10 @@ insert = primitive @"BEMapInsert"
|
||||
union : TextMap a -> TextMap a -> TextMap a
|
||||
union m1 m2 = foldl (\acc (k, v) -> insert k v acc) m2 (toList m1)
|
||||
|
||||
-- | Merge two maps.
|
||||
-- | Merge two maps. `merge f g h x y` applies `f` to all key/value pairs
|
||||
-- whose key only appears in `x`, `g` to all pairs whose key only appears
|
||||
-- in `y` and `h` to all pairs whose key appears in both `x` and `y`.
|
||||
-- In the end, all pairs yielding `Some` are collected as the result.
|
||||
merge
|
||||
: (Text -> a -> Optional c)
|
||||
-> (Text -> b -> Optional c)
|
||||
|
Loading…
Reference in New Issue
Block a user