Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Reduce code duplication #64

tibbe opened this Issue · 0 comments

1 participant


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
Something went wrong with that request. Please try again.