-
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
Make FsToolkit.ErrorHandling a superset of Cvdm.ErrorHandling? #3
Comments
Hi @cmeeren, Thanks for taking your time to put the questions together. To give background behind this library, I was a long time user of Chessie. In all the projects where I used Chessie, I kept carrying some utility functions around. After the introduction of the Result type (in F#) & Cvdm.ErrorHandling I found myself repeating the same. Hence I created the library with all those functions & CE that I was using in my projects. I never thought of the making this as a superset (or replacement of Cvdm) as I intended to share what I had. I second your thoughts on making as a superset, and I am open to merging the two projects and providing a unified library.
We can have this overload here as well.
My answer to the previous one applies here as well. The current functionalities represent what I used/required in my projects. We can add the others as well to make it useful for the overall community. I can add them in the next release, and I am open to your PR as well if you want to contribute.
For the above requirement, I am thinking to provide a solution similar to this https://vaskir.blogspot.com/2015/05/composing-custom-error-types-in-f.html. Currently, I don't have a concrete idea on how to go about it, and I am open to your suggestion.
I have mixed experiences with |
Glad to hear you're positive!
I think perhaps we misunderstand each other here, because I did not see anything in that blog post that was relevant to my point. I am talking about the functions defined in Helpers.fs. They assist in various stuff such as inline validation by converting simple values to As for implementing them in FsToolkit.ErrorHandling, the functions as well as their tests can of course be copied directly from Cvdm.ErrorHandling. Please take a look at Helpers.fs for details - do you agree that these would be helpful in FsToolkit.ErrorHandling?
I agree that it must be used very carefully to avoid unnecessary noise. In all my uses of Cvdm.ErrorHandling however, I find that I often use the CEs and the helper functions at most levels of my app, from basic domain logic to the application layer (e.g. Giraffe HttpHandlers). I would likely need to add The imported names in the case of Cvdm.ErrorHandling are the CEs ( In general: I have no problem letting you handle these changes yourself if you prefer that (much can be copied directly from Cvdm.ErrorHandling, and modified to suit your desired style). I am generally busy (who isn't?), particularly this weekend and the coming week. But if you want, I can help you with PRs (without promises on any time-frame). Do let me know if you want me to contribute anything specific; otherwise, I'll let you handle it. |
Sorry, @cmeeren for the delayed response. I was held up with some official & personal work. I went through the Regarding, I will create issues in GitHub for all missing features, whenever I start working on them (most likely coming weekend or next week) so that you will get an idea on what I am working on. Feel free to jump in create an issue/submit a pull request (with WIP status), if would like to collaborate. |
Great!
Absolutely.
Noted. I'll watch this repo to stay updated. As a final note, please do run the Cvdm.ErrorHandling unit tests against FsToolkit.ErrorHandling to see if there are any differences in behavior, particularly regarding the CE members. I'm no expert in CEs and have had some surprises along the way, so I basically wrote as complete a set of unit tests I could think of both to verify what's supported (e.g. |
Just want to let you know that there was a lot more to CEs than I had expected, and some of my original decisions turned out incorrect. I've released v2.0.0 of Cvdm.ErrorHandling now, with rewritten CEs and added tests. I have also added overloads accepting |
Thanks for the information.
I am held up with my office and personal commitments. Will incorporate your
changes when I start working on this.
…On Sat, 10 Nov 2018, 00:42 Christer van der Meeren ***@***.*** wrote:
Just want to let you know that there was a lot more to CEs than I had
expected, and some of my original decisions turned out incorrect. I've
released v2.0.0 of Cvdm.ErrorHandling now, with rewritten CEs and added
tests. I have also added overloads accepting Task<_> and Task expressions
to make interop easier.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#3 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AdgLEvRzIEyyIHguM4SrB-uDLFgvRCp_ks5utdOZgaJpZM4XaP0U>
.
|
Not sure the status of this issue but I also find that some things should be included. I have a gist that I always include in my FSharp projects (https://gist.github.com/AlbertoDePena/c91111a675d9c513cd09857efbd29aa7). Would it be possible to include some of these functions? Most, if not all, of it was a direct port from a talk I saw by Scot Wlaschin. |
@AlbertoDePena I haven't looked too closely at them, but many of them are already part of Cvdm.ErrorHandling under different (more semantic, less railway-analogous) names. See Helpers.fs. |
@demystifyfp By the way, regarding the (identical) |
Hi @AlbertoDePena Thanks for your comment. Currently, I am held up and I am planning to act on this in the last week of Jan. Will consider your gist while unifying both the libraries. @cmeeren Sure. |
@demystifyfp just a thought... BTW, this library is pure gold! Fantastic job... |
My two cents: If they are included in FSharp.Core, there is no reason to include them here. And even those that are not included should only be included here if they relate to error handling in some way, to keep the library focused. |
Hi @AlbertoDePena, Thanks for the compliment. All credits to the wonderful F# community! I second @cmeeren here. The objective of this library is making error handling in F# easier. If you feel certain functions need to be added here, feel free to create an open a Work In Progress PR or an issue with your thoughts. |
@cmeeren Finally got some time to push the changes. I started with porting the helper functions for Result. Except for the following two changes, ported everything.
The next plan is to port the helper functions for AsyncResult and finally the CE functions. Hopefully, by end of this month, we'll be able to complete this migration. Released a new NuGet version too! |
Great! I strongly recommend taking I use |
Thanks @cmeeren
I like this rationale. As I never faced this in my F# projects, I couldn't see the difference. Will add it in the next update. |
Hi @cmeeren, All the helper functions from Cvdm.ErrorHandling is now part of FsToolkit.ErrorHandling version Will be working on CE next! |
It seems I was mistaken regarding dropping I suggest including do! foo |> doA |> doB |> Result.requireEqualTo bar SomeErr This does not work with do! foo |> doA |> doB |> (fun intermediate -> Result.requireEquals intermediate bar SomeErr) which, I am sure you agree, is much less clear. Personally I would then also prefer |
How about adding |
Sounds good, thanks 👍 |
@cmeeren @TheAngryByrd Thanks for your work on making it possible. All your code changes are pushed as part of the new release (first major release) https://www.nuget.org/packages/FsToolkit.ErrorHandling/1.0.0 |
All Cvdm.ErrorHandling tests pass using FsToolkit.ErrorHandling 1.0.0. 👍 I recommend copying the extensive tests from Cvdm.ErrorHandling too, to prevent regressions in case the CE code is ever modified. |
This library looks great! Good documentation and more comprehensive than Cvdm.ErrorHandling with regards to operators and choice of CEs (
asyncResultOption
).Currently Cvdm.ErrorHandling has certain important features I don't immediately see in FsToolkit.ErrorHandling (having read the docs, not tested or browsed the code to any significant degree). I think I'd like for FsToolkit.ErrorHandling to be a superset of Cvdm.ErrorHandling and then simply retire the latter. The goals seem similar enough that I think this could be feasible, and it would benefit users by removing an unnecessary choice. How do you feel about that? Specifically:
Cvdm.ErrorHandling contains overloads on the
asyncResult
CE builder so that it can bind/returnResult<_,_>
expressions, not justAsync<Result<_,_>>
. This is a must for me as I useResult<_,_>
andAsync<Result<_,_>>
expressions interchangeably all the time (in the same CEs), and I won't move to another error handling library that doesn't have this. Not sure how the overload trick will work withAsyncResultOption
though, since it has three wrappers instead of two. Might work fine, might not work. Still, supporting this inAsyncResult
is better than none.Cvdm.ErrorHandling contains more members on the CE builders. Not sure from the top of my head what the practical differences are, but running relevant unit tests in Cvdm.ErrorHandling against FsToolkit.ErrorHandling should surface any missing features and incongruities in behaviour.
Cvdm.ErrorHandling contains quite a few helpers in the
Result
andAsyncResult
modules (e.g.requireSome
,requireTrue
,requireEqual
) to make it syntactically simpler to do ad-hoc validation in CEs when separate functions aren't really needed. See the readme for a couple of examples.Cvdm.ErrorHandling is
AutoOpen
ed. For the rationale behind this, see Set AutoOpen attribute for the assembly cmeeren/Cvdm.ErrorHandling#1.Thoughts?
The text was updated successfully, but these errors were encountered: