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

Set: A variant of insert that tells whether the element was already inside #31

Closed
nh2 opened this issue Jul 13, 2013 · 2 comments
Closed

Comments

@nh2
Copy link
Member

nh2 commented Jul 13, 2013

Would it make sense to add this?

Analog to insertLookupWithKey from Data.Map, saving one traversal.

insertLookup :: Ord a => a -> Set a -> (Bool, Set a)

or

insertLookup :: Ord a => a -> Set a -> Maybe (Set a)

@foxik
Copy link
Contributor

foxik commented Jul 13, 2013

My personal opinion is "It is not worth it". The API is wide enough as it is and I believe the speed difference between two calls lookup+insert and lookup+maybe insert is not so big.

Nevertheless, if you feel differently, do not hesitate to open a discussion at libraries@haskell, see http://www.haskell.org/haskellwiki/Library_submissions#Guidance_for_proposers.

Cheers,
Milan

@foxik
Copy link
Contributor

foxik commented Oct 19, 2014

Closing for now, please feel free to reopen if interested in it.

@foxik foxik closed this as completed Oct 19, 2014
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