Reduce code duplication #64

Open
tibbe opened this Issue May 10, 2013 · 0 comments

Comments

Projects
None yet
1 participant
Owner

tibbe commented May 10, 2013

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment