mergeWithKey' may be too general for its own good
- 主要语言
- Haskell
- 星标
- 355
- 派生
- 194
- 平均合并
- 3 天 4 小时
- 30 天内合并 PR
- 4
描述
It's cute that `mergeWithKey'` can implement so many different things, but there's a performance cost. Different operations necessitate different `Nil` checking, which `mergeWithKey'` has no way to deal with. The fact that the functions passed to it are often partial is also a bit disturbing, suggesting there may be a better approach. Having the combining function take maps instead of keys and values to enhance sharing sounds very reasonable until you see that it's actually only called for `Tip` trees. So the sharing is probably significant, but not earth-shattering. Using something like the evil pointer equality check could potentially have a much bigger impact, I imagine. Short of that, the partial functions could be avoided by passing both the `Tip` and its contents in separate arguments, although that's kind of ugly.
贡献指南
评估
这个 Issue 还没有评估数据。