Ticket #3002 (closed bug: fixed)
Documentation for Data.Map.unionWithKey makes reference to "new" and "old" values which have no meaning in a union.
| Reported by: | guest | Owned by: | igloo |
|---|---|---|---|
| Priority: | normal | Milestone: | 6.10.2 |
| Component: | libraries (other) | Version: | 6.10.1 |
| Keywords: | Cc: | ||
| Operating System: | Unknown/Multiple | Architecture: | Unknown/Multiple |
| Type of failure: | Difficulty: | Unknown | |
| Test Case: | Blocked By: | ||
| Blocking: | Related Tickets: |
Description (last modified by igloo) (diff)
The example given for unionWithKey uses rather odd names "new_value" and "old_value" for the values in the two maps. Perhaps more appropriate names would be leftValue and rightValue. This has been commented on in #haskell that where the values come from is not clear.
let f key new_value old_value = (show key) ++ ":" ++ new_value ++ "|" ++ old_value unionWithKey f (fromList [(5, "a"), (3, "b")]) (fromList [(5, "A"), (7, "C")]) == fromList [(3, "b"), (5, "5:a|A"), (7, "C")]
Change History
Note: See
TracTickets for help on using
tickets.
