Skip to content

Reduce code duplication #64

@tibbe

Description

@tibbe

There's excessive code duplication in the library due to near-identical implementations of several functions. This duplication has two causes:

  • Optimizations:
    • In the name of efficiency, some functions have been duplicate to avoid the cost of unused generality. For example, we have separate implementation of insert and insertWith, even though the former could be implemented in terms of the latter.
    • To support in-place update in the implementation of e.g. fromList, we have in-place versions of some functions e.g. unsafeInsert.
  • To provide both a strict and a lazy interface, some operations e.g. insertWith, have two implementations which only differs in the use of a seq or two.

I believe we can get rid of this duplication by implementing some generic functions that the others can be implemented in terms of and inline these hard enough.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions