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

[RFC FS-1004] FSharpResult type with a few tests #964

Merged
merged 10 commits into from Jul 7, 2016

Conversation

wallymathieu
Copy link
Contributor

@wallymathieu wallymathieu commented Feb 12, 2016

This is the implementation of RFC FS-1004 Result type

@msftclas
Copy link

Hi @wallymathieu, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution!

In order for us to evaluate and accept your PR, we ask that you sign a contribution license agreement. It's all electronic and will take just minutes. I promise there's no faxing. https://cla.microsoft.com.

TTYL, MSBOT;

@msftclas
Copy link

@wallymathieu, Thanks for signing the contribution license agreement so quickly! Actual humans will now validate the agreement and then evaluate the PR.

Thanks, MSBOT;

@enricosada
Copy link
Contributor

@wallymathieu can you add

@@ -601,7 +601,7 @@ namespace Microsoft.FSharp.Control
let mutable defaultCancellationTokenSource = new CancellationTokenSource()

[<NoEquality; NoComparison>]
type Result<'T> =
type AsyncImplResult<'T> =
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this a public type?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a private type. It's not exposed from control.fsi.

@forki
Copy link
Contributor

forki commented Feb 14, 2016

How does this relate to Chessie? Are you going to port the tests over? If we really put this into FSharp.Core then it should at least do what Chessie can. Especially in regards to C# interop this is a really hard topic. I tried so many things to make Chessie work for C# - so please also port the C# samples / tests to show that we have at elast that basic C# support that Chessie has.

@forki
Copy link
Contributor

forki commented Feb 14, 2016

/// <summary>Helper type for error handling without exceptions.</summary>
[<StructuralEquality; StructuralComparison>]
[<CompiledName("FSharpResult`2")>]
type Result<'T1,'T2> = 
| Success of 'T1 
| Error of 'T2

Is that really the type we want for Results? Chessie is using:

/// Represents the result of a computation.
type Result<'TSuccess, 'TMessage> = 
/// Represents the result of a successful computation.
| Ok of 'TSuccess * 'TMessage list
/// Represents the result of a failed computation.
| Bad of 'TMessage list

@wallymathieu wallymathieu changed the title FsharpResult type with a few tests [WIP] FsharpResult type with a few tests Feb 14, 2016
@wallymathieu
Copy link
Contributor Author

@enricosada there, I've updated the description and title.

// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

// Various tests for:
// Microsoft.FSharp.Core.ExtraTopLevelOperators.printf
Copy link
Contributor

Choose a reason for hiding this comment

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

Please adjust this comment to match the test target.

@KevinRansom
Copy link
Member

@wallymathieu @forki @dsyme @otawfik-ms
Guys,
where are we on this PR? it hasn't been touched since mid-feb and so looks like it might be dead. Do we want to add this functionality, shall we find someone to shepherd it through or drop it?

Kevin

[<StructuralEquality; StructuralComparison>]
[<CompiledName("FSharpResult`2")>]
type Result<'T1,'T2> =
| Success of 'T1
Copy link
Contributor

@dsyme dsyme Jun 25, 2016

Choose a reason for hiding this comment

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

Please rename Success to Ok

Copy link
Contributor

Choose a reason for hiding this comment

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

Please rename the type variables to T and TError

@dsyme
Copy link
Contributor

dsyme commented Jun 25, 2016

Please make the adjustments mentioned above and then we can accept this,

There is discussion in the RFC about whether we should also add a corresponding module of operations and a attempt builder into FSharp.Core as well. But minimally there is real value in accepting the definition of the type to help enable interop between different F# components that want to use this type.

@wallymathieu
Copy link
Contributor Author

Should I do a merge from master and fix the compilation error in Commands.fs?

@dsyme
Copy link
Contributor

dsyme commented Jun 28, 2016

@wallymathieu Yes please

@wallymathieu
Copy link
Contributor Author

wallymathieu commented Jul 3, 2016

The failure of Windows_NT Release_ci_part2 Build :
FSharp.Core.Unittests.FSharp_Core.Microsoft_FSharp_Control.AsyncModule.Async.AwaitWaitHandle does not leak memory
Does not look related to this pull request.

@dsyme
Copy link
Contributor

dsyme commented Jul 3, 2016

CLose/reopen to re-run CI

@dsyme dsyme closed this Jul 3, 2016
@dsyme dsyme reopened this Jul 3, 2016
@msftclas
Copy link

msftclas commented Jul 3, 2016

Hi @wallymathieu, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution!
You've already signed the contribution license agreement. Thanks!

The agreement was validated by Microsoft and real humans are currently evaluating your PR.

TTYL, MSBOT;

@wallymathieu
Copy link
Contributor Author

Should we change the title and remove [WIP] ?

@@ -3470,6 +3470,12 @@ namespace Microsoft.FSharp.Core
and 'T option = Option<'T>


[<StructuralEquality; StructuralComparison>]
[<CompiledName("FSharpResult`2")>]
type Result<'TOk,'TError> =
Copy link
Contributor

Choose a reason for hiding this comment

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

Please change to just "T" instead of "TOk"

@dsyme dsyme changed the title [WIP] FsharpResult type with a few tests FSharpResult type with a few tests Jul 6, 2016
@dsyme
Copy link
Contributor

dsyme commented Jul 6, 2016

@wallymathieu removed, thanks. Added one comment above TOk --> T

@dsyme dsyme changed the title FSharpResult type with a few tests [RFC FS-1004] FSharpResult type with a few tests Jul 6, 2016
@dsyme
Copy link
Contributor

dsyme commented Jul 6, 2016

@KevinRansom @otawfik-ms This is ready to merge.

@OmarTawfik
Copy link
Contributor

LGTM 👍

@OmarTawfik OmarTawfik merged commit aae9904 into dotnet:master Jul 7, 2016
@cartermp
Copy link
Contributor

cartermp commented Jul 7, 2016

👍

@wallymathieu wallymathieu deleted the fsharp_core_result branch July 7, 2016 18:52
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.

None yet

9 participants