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 Routes#apply #2550

Merged
merged 1 commit into from
Dec 8, 2023
Merged

Implement Routes#apply #2550

merged 1 commit into from
Dec 8, 2023

Conversation

adamgfraser
Copy link
Contributor

Resolves #2548. /claim #2548

Route#apply is already implemented and returns a ZIO[Env, Response, Response] so I think it makes sense for Routes#apply to do so as well. Also, I don't think the more polymorphic variant is well defined since a Route may already have a middleware applied to it that is a function from handler to handler where the error type is already specialized to Response and converting a Cause to a Response is not information preserving.

@987Nabil 987Nabil merged commit f9ffb0b into zio:main Dec 8, 2023
24 checks passed
@jdegoes
Copy link
Member

jdegoes commented Dec 8, 2023

I was pairing with a developer and we specifically needed an apply with no implicit evidence (i.e. polymorphic E). I thought it might be possible using an error type of Either[E, Response]. Namely by stuffing an E into a hidden defect Throwable and recovering at the end.

@adamgfraser adamgfraser deleted the 2548 branch December 8, 2023 19:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Route#apply and Routes#apply
4 participants