-
Notifications
You must be signed in to change notification settings - Fork 62
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: Add 'Ensure' and 'Check' method similar to C#FunctionalExtensions #281
Comments
👋 This look like good ideas! Go ahead a put a PR together so we can go over some more designs. |
@TheAngryByrd Heyo! I've finished the first draft of the PR and its ready for review, but I can't seem to publish a branch Do I need to do something special, otherwise do you mind granting permissions? Im not looking to have perms to merge anything, just to create a branch. I am able to pull |
Great to hear! It's because you don't have permission to push to |
Heyo! Thanks for being patient with me! |
Hi! Loving the library. Using this library has felt very natural to me, as I use CSharpFunctionalExtensions all the time in C#.
I think the library identifies some helpful methods that could be useful in this library too, and I have highlighted them below.
If there are already more 'FSharp' style ways of approaching this, I am very open. I don't mind being wrong :)
Ensure
From the source code:
Ensure allows you to evaluate a predicate. If the predicate is false, then return an error.
Example usage of
ensure
Before:
After:
Check
From the source code:
This method allows you to keep the calling success condition of the result.
Example usage of Check
Here is a code snippet that could utilize check
Here, using
check
would look like so:I can appreciate here the code difference is small, but I think the semantic difference is helpful.
Again, I am new to f#, so if this is not the idiomatic way of doing things, then let me know - But if this is liked im happy to submit a PR.
The text was updated successfully, but these errors were encountered: