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

Adding uncontentious methods from RFC FS-1004 #1350

Merged
merged 8 commits into from
Jul 22, 2016

Conversation

wallymathieu
Copy link
Contributor

@wallymathieu wallymathieu commented Jul 14, 2016

https://github.com/fsharp/FSharpLangDesign/blob/master/RFCs/FS-1004-result-type.md

bind : ('T -> Result<'U, 'TError>) -> Result<'T, 'TError> -> Result<'U, 'TError>
map : ('T -> 'U) -> Result<'T, 'TError> -> Result<'U, 'TError>
mapError : ('TError -> 'U) -> Result<'T, 'TError> -> Result<'T, 'U>

The implementation is heavily inspired by how the Option module is structured.

I've added the files in the collections meta folder, since that's where option.fsi and option.fs live (in my mind is somewhat similar).

@msftclas
Copy link

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 wallymathieu changed the title [WIP] Adding uncontentious methods from RFC FS-1004 Adding uncontentious methods from RFC FS-1004 Jul 15, 2016
@dsyme
Copy link
Contributor

dsyme commented Jul 15, 2016

This looks good, I'm ok with this addition to the RFC for this release.

Please add 3-4 unit tests to the FSharp.Core unittests?

@dsyme
Copy link
Contributor

dsyme commented Jul 16, 2016

AppVeyor lists this failure

[00:33:41] 1) Failed : FSharp-Tests-Core+Members+Incremental.incremental(FSI_FILE)
[00:33:41] Error running command 'C:\projects\visualfsharp-3dtit\tests\..\release\net40\bin\fsiAnyCPU.exe' with args ' -r:System.Core.dll --nowarn:20 --define:INTERACTIVE --maxerrors:1 --abortonerror test.fsx' in directory 'C:\projects\visualfsharp-3dtit\tests\fsharp\core\members\incremental'. ERRORLEVEL -1073740771 ERRORLEVEL -1073740771
[00:33:41] at NUnitConf.checkTestResult(Result`2 result) in C:\projects\visualfsharp-3dtit\tests\fsharp\nunitConf.fs:line 14

Not sure why, it looks unrelated to your changes.

@wallymathieu
Copy link
Contributor Author

Quite odd indeed.

@wallymathieu
Copy link
Contributor Author

That build looks a bit flaky.

@wallymathieu
Copy link
Contributor Author

Looks like all it needed was some random nudge. ;)

[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
module Result =

/// <summary><c>map f inp</c> evaluates to <c>match inp with Error e -> Error e | Ok x -> Ok (f x)</c>.</summary>
Copy link
Contributor

@dsyme dsyme Jul 22, 2016

Choose a reason for hiding this comment

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

These summaries should be English-language. I know they're using the style from the "Option" summaries, but those ones should really be changed too :)

The MSDN docs use summary strings like Transforms an option value by using a specified mapping function.

@dsyme dsyme merged commit 047d472 into dotnet:master Jul 22, 2016
@dsyme
Copy link
Contributor

dsyme commented Jul 22, 2016

Merging, will update the doc strings separately.

@cartermp
Copy link
Contributor

👍

@manofstick manofstick mentioned this pull request Oct 14, 2016
99 tasks
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.

4 participants