#3002: Documentation for Data.Map.unionWithKey makes reference to "new" and
"old"
values which have no meaning in a union.
----------------------------------+-----------------------------------------
Reporter: guest | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: libraries (other) | Version: 6.10.1
Severity: trivial | Resolution:
Keywords: | Difficulty: Unknown
Testcase: | Os: Unknown/Multiple
Architecture: Unknown/Multiple |
----------------------------------+-----------------------------------------
Changes (by igloo):
* difficulty: => Unknown
Old description:
> 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")]
New description:
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")]
}}}
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3002#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs