Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check collisions function #33

Open
jkarni opened this issue Jul 27, 2015 · 1 comment
Open

Check collisions function #33

jkarni opened this issue Jul 27, 2015 · 1 comment

Comments

@jkarni
Copy link

jkarni commented Jul 27, 2015

Using the examples/Foo.hs:

> test
fromList [Foo {fooId = 1, fooBar = "One", fooBaz = 1.0},Foo {fooId = 2, fooBar = "Two", fooBaz = 2.0},Foo {fooId = 3, fooBar = "Three", fooBaz = 3.0},Foo {fooId = 4, fooBar = "Four", fooBaz = 4.0},Foo {fooId = 5, fooBar = "Five", fooBaz = 5.0}]

> count test
5

> insert (Foo 2 "Two" 1.0) test
fromList [Foo {fooId = 2, fooBar = "Two", fooBaz = 1.0},Foo {fooId = 3, fooBar = "Three", fooBaz = 3.0},Foo {fooId = 4, fooBar = "Four", fooBaz = 4.0},Foo {fooId = 5, fooBar = "Five", fooBaz = 5.0}]

> count $ insert (Foo 2 "Two" 1.0) test
4

I would expect inserts that are conditional on there being no collisions are a more common use-case than removing all collisions (and that perhaps insert is a slightly confusing name for something that can result in fewer entries). Could such a conditional-insert functionality be provided?

@ekmett
Copy link
Owner

ekmett commented Aug 18, 2015

I have no particular objection to accepting such a function into the library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants