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

Add a few list helper functions #1574

Merged
merged 3 commits into from
May 28, 2024
Merged

Add a few list helper functions #1574

merged 3 commits into from
May 28, 2024

Conversation

ag-eitilt
Copy link
Collaborator

@ag-eitilt ag-eitilt commented May 24, 2024

There's been a few times I and @maniltongya have lamented not having some less-obvious List helpers we'd reach for in Haskell; this adds the two we had talked about previously, and I quickly scanned through Data.List but didn't see anything else immediately relevant -- feel free to suggest others, though, if I did miss something.

Additionally, this implements the note that we'd eventually add single for similar limited benefit as prepend (i.e. not having to write a parenthetical underscore-lambda when we want to pass it to some other function). I deliberately haven't brought over the similarly-notated lookup since it's not the type signature or semantics people would expect from that name, people should probably use a Map if they need to make a lot of mlookup calls, and there's enough variation in whether they'd want just the value or the key and the value (since the predicate might be written to match multiple keys) that I didn't feel a single helper was helpful when we already have find.

@ag-eitilt ag-eitilt requested review from colinschmidt and V-FEXrt May 24, 2024 22:50
@ag-eitilt ag-eitilt merged commit a2d0664 into master May 28, 2024
12 checks passed
@ag-eitilt ag-eitilt deleted the extra-list-helpers branch May 28, 2024 21:33
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