-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use the new Result type instead of Choice for Errors
Closes #52
- Loading branch information
Showing
16 changed files
with
170 additions
and
147 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
d23d847
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a breaking change, but since we're still behind the 1.0.0 release changes like this should be expected.
The main idea is that
Result<'T,'U>
is preferred overChoice<'T,'U>
to model effects which represents computations that might fail. ButChoice
will still be preferred to model computations where the second parameter doesn't necessarily represents an error.Summary:
The module with Extensions previously called
Error
is now renamed toChoice
and there is a new module calledResult
. They both contains exactly the same functions. These names are less ambiguous and also force you to decide which model to follow when migrating old code.The generic function
either
now operates overResult<'T,'U>
. The old version is still available asChoice.either
.Choice Functors, Applicatives and Monads will continue to work on
Choice
,Result
was added as another instance.ArrowChoice will keep using
Choice
because AFAIK they're not necessarily modelling errors.The dummy type
Either
is no longer required, we can useChoice
to ambiguate in overload resolution. This is more an internal change.The monad transformer
ErrorT
operates withResult
.Choice prisms were removed in favor of
_Ok
and_Error
. They can be added again in the future but right now will force you to migrate.d23d847
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍