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

Abstract Handler #641

Closed
jkarni opened this issue Nov 23, 2016 · 5 comments
Closed

Abstract Handler #641

jkarni opened this issue Nov 23, 2016 · 5 comments

Comments

@jkarni
Copy link
Member

jkarni commented Nov 23, 2016

@kosmikus suggested this a while back, but: is everyone okay with making Handler it's own abstract monad (rather than a type synonym)? This will make it easier to add more instances without breaking backwards compatibility.

Currently I'm thinking of making it a MonadResource (as part of the work on file uploads, I'd be using MonadResource anyhow, and it seems reasonable to allow handlers to also register cleanup actions). I've also thought about adding functions:

etagIs :: Etag -> Handler ()
lastModifiedAt :: DateTime -> Handler ()

With the functionality that if there is a If-Match/If-None-Match (or If-Modified-Since/If-Unmodified-Since) header in the request that doesn't/does match the mentioned Etag/DateTime, and appropriate throwError is thrown. (This seems like a nice API for servers, but I still haven't figured out how it would work for clients.)

@phadej
Copy link
Contributor

phadej commented Nov 23, 2016

I'm 👍, and let's make ClientM a newtype as well!

@jkarni
Copy link
Member Author

jkarni commented Nov 23, 2016

ClientM already is!

@phadej
Copy link
Contributor

phadej commented Nov 23, 2016

Oh, I didn't even realised that. I'd say the Handler change should follow.

@kosmikus
Copy link
Contributor

Unsurprisingly, I support this change. I still don't like the M in ClientM, but that's unrelated ...

@3noch
Copy link

3noch commented Nov 23, 2016

Yes please!

@phadej phadej added this to the 0.10 milestone Jan 13, 2017
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

4 participants