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
feat request: Add popLeftWithValue
and popWithValue
in Data.Sequence
#977
Comments
we do have views that solve exactly this problem? https://hackage.haskell.org/package/containers-0.7/docs/Data-Sequence.html#g:7 |
I have seen these two be commonly called
There are already two ways to do this:
But I can see the utility in adding these for |
Yes, you are right. I think it is possible to implement both I would be inclined to create a PR if only the maintainer would allow me to do so. |
can you demonstrate (by a concrete example) that the proposed functions help to improve your code? I think (as a user/teacher) the bar should be quite high for non-essential extensions of the API (where "essential" = "not expressible by functions that are already present") other uses of if you want concise code, then this (using patterns) seems quite good:
note that you don't need |
I've thought a lot about your opinion. Indeed, the functions I suggested are functions that can be expressed by existing functions, so if I add these functions, it could compromise the compactness of the library. I decided that if users want to use these functions, they should implement them themselves in their own projects and use them. So it seems that it is not necessary to add these functions Thank you for your valuable opinion! |
Proposal
I think it would be useful to have a function in
Data.Sequence
that deletes the edge value and at the same time retrieves the rest of the Sequence without the edge value.The naming is tentative, but the function is as follows
Also, functions like
head
,tail
,last
, andinit
using Maybe monad would surely be useful to add toData.Sequence
.What do you think?
The text was updated successfully, but these errors were encountered: