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

Implement #or to either #19

Merged
merged 2 commits into from
May 1, 2019
Merged

Implement #or to either #19

merged 2 commits into from
May 1, 2019

Conversation

moba1
Copy link
Collaborator

@moba1 moba1 commented May 1, 2019

Abstract

Implement #or method to Either(T) and add test.
If receiver is Right, this method returns value which is same as receiver, otherwise, returns Either monad which is argument.

Example

# If `value` is `Right`, `#or` return `value`
value = Right.new(1)
value.or(Left.new("string")) == Right.new(1)

# If `value` is `Left`, `#or` return argument
value = Left.new(1)
value.or(Right.new("string")) == Right.new("string")

@moba1 moba1 requested a review from alex-lairan May 1, 2019 09:56
@alex-lairan alex-lairan merged commit 5c65baa into master May 1, 2019
@alex-lairan alex-lairan deleted the add/implement-#or-to-either branch May 1, 2019 11:04
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.

None yet

2 participants