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

Use Set.member instead of Foldable.elem #4128

Merged
merged 1 commit into from
Mar 10, 2024

Conversation

jhrcek
Copy link
Collaborator

@jhrcek jhrcek commented Mar 10, 2024

Set.member is generally more efficient because it can use Ord constraint unlike Foldable.elem which can only use Eq class and has to traverse the whole thing if the element is not present.

using Set/Map.singleton is less important but I still find it useful because it reduces visual noise.

Copy link
Collaborator

@fendor fendor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@jhrcek jhrcek merged commit 78e55d4 into master Mar 10, 2024
39 checks passed
@jhrcek jhrcek deleted the jhrcek/set-map-singleton-member branch March 11, 2024 05:52
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

Successfully merging this pull request may close these issues.

2 participants