Open immae opened 1 year ago
I've never actually used NamedRoutes
before.
Could you upload a branch with the (non-working) code you currently have?
Thanks for your consideration. I took a bit of time to extract what I tried to do from local specificities. You’ll find the attempt here: https://github.com/immae/servant-checked-exceptions/tree/wip-named-routes
I added an "example" file /Movies.hs
(which I use in the repl to play around), using the NamedRoutes example from Servant themselves (https://docs.servant.dev/en/inserting_doc_namedroutes/cookbook/namedRoutes/NamedRoutes.html ), and tried to "build" an api that can Throw from it and add the needed instances. Somehow I got a bit further than what I achieved in my own local work (I have a feeling that the AsEnveloppedServerT
is kind of necessary), but I’m still not there.
Sorry that I cannot help more, It’s easy to get lost in all the Servant types.
Hope this sketch helps a bit!
I took a look at this, but I don't think I'll have time to grok exactly how Generic
is being used in the implementation of NamedRoutes
, at least to the point where I can use it to implement support here in servant-checked-exceptions
.
For anyone else interested, here is the servant-server
code that deals with NamedRoutes
:
I'd be happy to merge a PR adding support for NamedRoutes
here in servant-checked-exceptions
if someone is able to figure everything out.
Thank you for taking the time to look at it.
I didn’t make progress so far (further than what I published already in the branch)
I’m trying to use the servant-checked-exceptions package with NamedRoutes. But I want to add the "Throws" at the top of the api, for instance:
But
Throws
is not able to traverse NamedRoutes types. I tried to implement aHasServer (Throwing '[e] :> NamedRoutes api)
instance, but I seem unable to do it correctly (I tried to find other packages that implement a similar instance too to use as example, in vain). I’d appreciate help for implementing that.Thanks!