-
-
Notifications
You must be signed in to change notification settings - Fork 414
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
Wrap Application in custom monad for Raw endpoint #1349
Conversation
This is a breaking change, so maybe it makes sense to introduce a new combinator, like |
I like it, but as you can tell we're a bit behind with processing PRs. Would you be interested in joining the maintainer team? :-) If not, we'll get to this eventually. I agree with the breaking change, any other opinions? |
80df111
to
131f1eb
Compare
Currently handler `Raw` endpoint for is just an `Application`: a value. This value has no access to the context of an arbitrary monad that may be used instead of the default `Handler`. This commit changes handler type to `m Application`, allowing the user to do arbitrary actions in `m` prior to generating an `Application`. This is useful to do custom logic behind `servant`s back while still having access to the environment of user's monad.
131f1eb
to
7ad02d3
Compare
Well, maintaining such an important library is a great responsibility... Can I help with current problems? I'd love to see uverbs finally in master, for example. |
Actually I was able to generalize this even further, please take a look. |
71c3240
to
11d8421
Compare
11d8421
to
277ec04
Compare
JFYI: There is https://github.com/cdepillabout/servant-rawm, which solves this exact problem. I think it is a very good idea to integrate it/sth similiar in this repo! In particular, it will make it easier to close cdepillabout/servant-rawm#7, as servant-auth can provide the required instance out of the box (without having to write a servant-auth-rawm compat package). |
Oops, perhaps I should've looked for prior art :) However, newest version of this PR is actually better than that package, as it allows you to run |
I've just released 0.18.1 to Hackage. I believe this change will have to go into 0.19, as it's kinda breaking. What do you think? |
I agree that the One nice feature of servant-rawm is that it allows to customize the |
Currently handler
Raw
endpoint for is just anApplication
: a value.This value has no access to the context of an arbitrary monad that may
be used instead of the default
Handler
.This commit changes handler type to
m Application
, allowing the userto do arbitrary actions in
m
prior to generating anApplication
.This is useful to do custom logic behind
servant
s back while stillhaving access to the environment of user's monad.