haskell / containers

Assorted concrete container types

Home Page:https://hackage.haskell.org/package/containers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Data.Map.mergeWithKey doesn't match documentation

mniip opened this issue · comments

The documentation for Data.Map.Lazy.mergeWithKey states:

  • a nonempty subtree present only in the first map is passed to only1 and the output is added to the result;
  • a nonempty subtree present only in the second map is passed to only2 and the output is added to the result.

Yet this example shows otherwise:

M.mergeWithKey
  (\k x y -> traceShow ("merge", k, x, y) $ Just x)
  (\m -> traceShow ("left", m) M.empty)
  (\m -> traceShow ("right", m) M.empty)
  M.empty
  M.empty
  `seq` ()
("right",fromList [])
()

The same isssue exists in the Strict version, and in both IntMap versions.