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

Both Result and Choice for error handling #32

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

wallymathieu
Copy link
Contributor

@wallymathieu wallymathieu commented Oct 30, 2017

  • Forked individual files from Using Result<,> instead of Choice<_,'Error> #31 and reverted original files
  • Added Compatibility namespaces and moved some Choice constructs into these
  • Renamed Notification.Error to Notification.Exception in order to avoid confusing things with Result<,>

@wallymathieu
Copy link
Contributor Author

Note that I've added same kind of test as can be found for Fold for FoldBack @jack-pappas

@wallymathieu
Copy link
Contributor Author

@vasily-kirichenko and @jack-pappas thoughts? Does it look ok?

open System.Runtime.CompilerServices
open ExtCore.Control
open NUnit.Framework
//open FsCheck
Copy link
Collaborator

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`` =
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove <summary> tag.

Copy link
Contributor Author

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>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove it?



/// <summary>
/// </summary>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove.

/// <summary>
/// </summary>
[<Sealed>]
type ProtectedResultStateContBuilder () =
Copy link
Collaborator

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.

Copy link
Contributor Author

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 ?



/// <summary>
/// </summary>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove.

[<AutoOpen>]
module ResultWorkflowBuilders =

//
Copy link
Collaborator

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)>]
Copy link
Collaborator

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

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>
Copy link
Collaborator

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?

Copy link
Contributor Author

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?

Copy link
Collaborator

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 _ -> ()

Copy link
Contributor Author

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

Copy link
Owner

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.

@jack-pappas
Copy link
Owner

Thanks @wallymathieu — I’ll take a look at this over the weekend.

@vasily-kirichenko
Copy link
Collaborator

@jack-pappas could you please publish a new NuGet package after merging this PR?

@wallymathieu
Copy link
Contributor Author

https://gist.github.com/wallymathieu/ad8fe3d5b85875cf6f487ad0180be660 ?

@wallymathieu
Copy link
Contributor Author

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?

@@ -806,7 +791,7 @@ module Lazy =
#endif

/// Additional functional operators on options.
[<RequireQualifiedAccess; CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
[<RequireQualifiedAccess>]
Copy link
Owner

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?

Copy link
Contributor Author

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.

@vasily-kirichenko
Copy link
Collaborator

Is there a plan to merge this?

@wallymathieu
Copy link
Contributor Author

Should we close this pull request @jack-pappas (as it is to big) ?

@wallymathieu
Copy link
Contributor Author

I'm closing this PR as it is probably to big to review or accept. Best of luck!

@vasily-kirichenko
Copy link
Collaborator

@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.

@wallymathieu
Copy link
Contributor Author

Since @vasily-kirichenko says that it's working fine, I've reopened the pull request

@vasily-kirichenko
Copy link
Collaborator

Yes, it's working 100% fine.

@wallymathieu
Copy link
Contributor Author

Then perhaps move this PR to point to another branch on this repository in order to iterate on it?

@vasily-kirichenko
Copy link
Collaborator

@wallymathieu Could you merge master into it to make AppVeyor happy?

@wallymathieu
Copy link
Contributor Author

Will do!

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.

3 participants