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

Adapt ZIO.someOrFailException to improve interop with error types #2087

Merged
merged 1 commit into from Nov 11, 2019

Conversation

mlangc
Copy link
Contributor

@mlangc mlangc commented Nov 2, 2019

This PR adapts the signature of ZIO.someOrFailException to better work with commonly used error types like Throwable. For example, without this PR,

Task(Option(3)).someOrFailException

does not compile, but with this PR, it does.

Something that does not yet compile is (io: IO[E, Option[A]]).someOrFailException if E is not a supertype of NoSuchElementException, like (io: IO[IllegalArgumentException, Option[A]]).someOrFailException. Ideally, this should work, with the error type of the result being the most specific common supertype of E and NoSuchElementException, but I didn't yet find a way to achieve this.

In any way, this PR is an improvement over the existing state of affairs.

@iravid
Copy link
Member

iravid commented Nov 11, 2019

Thanks @mlangc!

@iravid iravid merged commit 254e910 into zio:master Nov 11, 2019
Twizty pushed a commit to Twizty/zio that referenced this pull request Nov 13, 2019
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