Deprecate OnFailure()
See original GitHub issueSimilar to the recent refactoring in #141, I propose to:
-
Refactor
OnFailureintoMapFailureand markOnFailureas[Obsolete]. This will bring extension methods to consistency with F#'sResultat https://github.com/fsharp/fsharp/blob/master/src/fsharp/FSharp.Core/result.fs (MapFailureand notMapErrorbecauseErrorandIsFailureare different members in ourResultandFailureis closer semantically to describing the result’s state). -
Move the existing
MapFailuremethods out ofResult/Result<T>/Result<T,E>to extensions that replaceOnFailure( https://github.com/vkhorikov/CSharpFunctionalExtensions/blob/master/CSharpFunctionalExtensions/Result/Result.cs#L554-L567 and similar).
@space-alien let me know if you can do that. If you are short on time, I’ll try to refactor myself this weekend.
Issue Analytics
- State:
- Created 4 years ago
- Comments:10 (5 by maintainers)

Top Related StackOverflow Question
Have pushed a commit renaming
MapFailure->ConvertFailure. Work continues on the other points.I remembered your comment on #135. I had also been thinking along these lines for a while.
One option would be to refactor as follows:
And the same principle for
Bind()andTap():Fortunately, I don’t think any of this would be a breaking change (even with the current
MapFailure).I’m still trying to decide if I have an issue with the semantics of
MapFailure/MapSuccess, and their Bind/Tap equivalents. For the reader unfamiliar with the library, it may not be instantly obvious whether:It may be pretty daft to infer (2), but any ambiguity potentially draws some of the reader’s brainpower to reach the right conclusion. And one of the benefits of this library has always been its ability to make expected behaviour obvious.
So, here’s the “blindingly-obvious” alternative…!