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
Add isOk and isError to the Result type #623
Comments
Should we also add other types to the Result module, such as |
I sometimes use I'm a bit more unsure about the rest, though. With In any case, this might belong in a separate suggestion. |
I was referring to |
Ah. I can see the use, but as with |
Well it can be seen as a way to "recover" from an error |
Yes, that makes sense too. In any case, there are considerations there that are not relevant for |
I would need this right now for C# :( |
Not sure what you say you are needing for C#, whether you are wanting isOk and isError functions, or just a Result type in general. If either of those two cases, I could point you over to TheJayMann/LinqToResult which contains a Result type, which has a property named IsSuccess, and also has Linq methods which allow a syntax similar to computation expression. If you are using the FSharp Result type directly in C#, or if you were referring to something else completely, I don't think I have any suggestions. |
Well instance members will do for now... I prefer the other variant though |
I'd be in favor of:
|
@cartermp, 'on the type', what do you mean with that? Instance members, static members? As static members wouldn't make much sense if you also add them to the module, so I assume instance members, right? |
Yes, instance members. |
In addition to
I like I also use |
@charlesroddie I very much agree, but as @cmeeren said previously, these should probably be taken up in a different issue. |
I think (part of) this feature will be automatically available once #222 is completed. |
Is this still open for consideration? I've found myself adding a lot of parallels from |
I think we'll consolidate concerns here with #222, so I'll close this out to de-duplicate |
I propose adding
isOk
andisError
to theResult
type/module, similar to how we haveisSome
andisNone
in theOption
module.Currently one has to define the functions manually:
Pros and Cons
Advantages:
Ok
orError
(similar to checking if anOption
isSome
orNone
)Disadvantages: None.
Extra information
Estimated cost: XS
Affidavit
Please tick this by placing a cross in the box:
Please tick all that apply:
The text was updated successfully, but these errors were encountered: