-
Notifications
You must be signed in to change notification settings - Fork 32
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
Both Result and Choice for error handling #32
base: master
Are you sure you want to change the base?
Both Result and Choice for error handling #32
Conversation
Note that I've added same kind of test as can be found for Fold for FoldBack @jack-pappas |
@vasily-kirichenko and @jack-pappas thoughts? Does it look ok? |
ExtCore.Tests/Control.Result.fs
Outdated
open System.Runtime.CompilerServices | ||
open ExtCore.Control | ||
open NUnit.Framework | ||
//open FsCheck |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove it?
assertEqual (Ok true) result | ||
|
||
/// <summary>Tests for <see cref="ExtCore.Control.ResultBuilder.While"/>.</summary> | ||
module ``ResultBuilder_While`` = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove <summary>
tag.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's a bit extra, that's why?
|
||
|
||
/// <summary> | ||
/// </summary> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove it?
|
||
|
||
/// <summary> | ||
/// </summary> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove.
ExtCore/Control.Cps.Result.fs
Outdated
/// <summary> | ||
/// </summary> | ||
[<Sealed>] | ||
type ProtectedResultStateContBuilder () = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like the name. The "choice" version is named just "ProtectedState..." where "protected" means Either-style error handling. Here we have a kind of duplication: "protected" and "result" both point to the same aspect of the builder - errors handling.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, should we move the "choice" versions to "compatibility" namespace, so that the result versions can have the same name ?
ExtCore/Control.Cps.Result.fs
Outdated
|
||
|
||
/// <summary> | ||
/// </summary> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove.
[<AutoOpen>] | ||
module ResultWorkflowBuilders = | ||
|
||
// |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see any value in all these empty comments. Maybe remove all of them everywhere?
open ExtCore | ||
open ExtCore.Control.Indexed | ||
/// Indexed-state workflows. | ||
[<RequireQualifiedAccess; CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)
is not needed in most cases in F# 4.1, maybe remove all of them while you are at it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So yes, should be removed
/// <typeparam name="S1"></typeparam> | ||
/// <typeparam name="S2"></typeparam> | ||
/// <typeparam name="T"></typeparam> | ||
/// <typeparam name="Error"></typeparam> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove all such meaningless XML Docs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could they have been added in order to silence warnings about missing xml docs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe. if so, it smells like try..with _ -> ()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some of these things could be improved by a little bit of documentation, for instance It's a bit confusing to read the CPS function definitions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added these empty XML docs to remind myself -- years ago -- to fill them in so new users would get some helpful hints from Intellisense. Obviously, I still haven't gotten around to doing it, but I think Oskar's right -- it'd be helpful to users to have the information rather than just removing the comments.
Thanks @wallymathieu — I’ll take a look at this over the weekend. |
@jack-pappas could you please publish a new NuGet package after merging this PR? |
Should we perhaps try to split this pull request into more granular parts? A lot changes are mostly copy and modify (in order to be compatible). @vasily-kirichenko do you have an idea of how this could be done? |
ExtCore/Pervasive.fs
Outdated
@@ -806,7 +791,7 @@ module Lazy = | |||
#endif | |||
|
|||
/// Additional functional operators on options. | |||
[<RequireQualifiedAccess; CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>] | |||
[<RequireQualifiedAccess>] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was the CompilationRepresentation
attribute removed here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it was due to a thing @vasily-kirichenko said, that it's no longer needed.
Is there a plan to merge this? |
Should we close this pull request @jack-pappas (as it is to big) ? |
I'm closing this PR as it is probably to big to review or accept. Best of luck! |
@jack-pappas Please, merge this PR. I had to build an ExtCore package myself and publish it on a private server, everything's been working OK. |
Since @vasily-kirichenko says that it's working fine, I've reopened the pull request |
Yes, it's working 100% fine. |
Then perhaps move this PR to point to another branch on this repository in order to iterate on it? |
@wallymathieu Could you merge master into it to make AppVeyor happy? |
Will do! |
Compatibility
namespaces and moved someChoice
constructs into theseNotification.Error
toNotification.Exception
in order to avoid confusing things withResult<,>