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

Result.Ok() and Maybe.Some() promote instead of transform #42

Merged
merged 4 commits into from
Oct 27, 2015

Conversation

uniphil
Copy link
Owner

@uniphil uniphil commented Oct 27, 2015

Those functions return their argument if the argument is already an Err or Ok, or None or Some, respectively.

This brings the API closer to Promise, specifically Promise.resolve().

Promise.resolve is like a cast: it promotes regular values to resolved
promises, or uses the promise passed to it. Results' API for Result.Ok() and
Maybe.Some() should match this.

The current behaviour is based off of a mis-reading of Promise.resolve.

These tests should validate the desired behaviour.
Maybe.Some() and Result.Ok() now promote, so just use those.

Also, .andThen() promotes, so let that happen automatically in `.all`s.
uniphil added a commit that referenced this pull request Oct 27, 2015
Result.Ok() and Maybe.Some() promote instead of transform
@uniphil uniphil merged commit 6aa14d0 into master Oct 27, 2015
@uniphil uniphil deleted the fix-casting branch October 27, 2015 17:30
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.

1 participant