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

Routes: Http Server via Tapir #175

Closed
danslapman opened this issue Jan 31, 2024 · 4 comments
Closed

Routes: Http Server via Tapir #175

danslapman opened this issue Jan 31, 2024 · 4 comments

Comments

@danslapman
Copy link

danslapman commented Jan 31, 2024

Hi! Being pretty impressed with kyo's features i tried to migrate one of my application from ZIO to KYO. Since it is a tapir-based backend the first thing i needed was to implement some kind of tapir-kyo integration module. Result of my attempt can be found here. sttp's design relies on MonadError, so, I decided to bound my effect with Aborts. Here came the first problem - Flat's: it's impossible to add an extra bound to an arbitrary typeclass method. For the experiment I ended up with Flat.unsafe.unchecked. On the next step I finally stuck with another problem - Tag's, which again couldn't be provided.

Am I mistaken in the way I designed my instances? While it's not entirely necessary - I agree we can get rid of tapir and build an application without cats/scalaz/whatever, I think it's good to have a way to live side-by-side.

Anyway, thanks for the fantastic effort on KYO, Quill and all other brilliant libraries!

@fwbrasil
Copy link
Collaborator

Thanks for the feedback! It's odd that I haven't seen bug reports yet, did you encounter any?

I'm also in need of an HTTP server for Kyo. Did you see the initial integration in the repo? It uses this monad definition from the sttp module but it also relies on Flat.unsafe for error handling.

I'll take a look if it'd be possible to avoid the flat check for error handling (Tries.run). It's a common operation and ends up making the check appear in several unexpected places.

@danslapman
Copy link
Author

danslapman commented Feb 10, 2024

Thanks @fwbrasil, I definitely missed that code 😅 I will try to adopt it. As for bugs - I didn't encounter something yet, I'll report back after minimal working rewrite

@fwbrasil
Copy link
Collaborator

fwbrasil commented Mar 20, 2024

@danslapman I used Kyo for a performance benchmark challenge and finalized the initial version of the Tapir integration for it. I've submitted a few optimizations to Tapir as well. The documentation for the module is still missing but you can take a look at the usage here: https://github.com/fwbrasil/rinha-2024-q1/tree/main/src/main/scala/rinha

@fwbrasil fwbrasil changed the title Feedback after an attempt of (kinda) real-life kyo usage Tapir integration Mar 20, 2024
@fwbrasil fwbrasil changed the title Tapir integration Routes: Http Server via Tapir Mar 22, 2024
@fwbrasil
Copy link
Collaborator

Closing in favor of #219

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants