Document the Middleware type alias#858
Merged
Merged
Conversation
8405f4d to
c04c7af
Compare
Contributor
Author
|
Please check especially the code examples, I tried most of them in a slightly modified form on the REPL, but I might have typoed something. The examples are not copy-pastable, which would be the gold standard, but I think pseudocode like this already helps a lot in practice. |
Contributor
Author
Contributor
Author
|
Looks to me like the Windows CI failure is unrelated. |
snoyberg
requested changes
Oct 21, 2021
snoyberg
left a comment
Member
There was a problem hiding this comment.
Overall looks good, some minor points added
I tried to come at this from the angle of 1) A user of Wai trying to understand what `Middleware` is and how to use it, especially what happens if you chain multiple middlewares and in what order their are called. 2) A developer trying to implement new middleware, how to modify requests and responses, and how to pass on data. by giving examples of how the type signatures and simple usage/implementations look. I think `Wai` is a super fundamental module for the Haskell ecosystem, so we should aim for the documentation to be top notch (think: rust stdlib). I think the rest of the module needs a simple overhaul, but I was especially annoyed by having to reconstruct Middleware from first principles every time I built a server (“which order does it chain again?”).
c04c7af to
398c48b
Compare
Member
|
Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



I tried to come at this from the angle of
A user of Wai trying to understand what
Middlewareisand how to use it, especially what happens if you chain
multiple middlewares and in what order their are called.
A developer trying to implement new middleware, how to
modify requests and responses, and how to pass on data.
by giving examples of how the type signatures and
simple usage/implementations look.
I think
Waiis a super fundamental module for the Haskellecosystem, so we should aim for the documentation to be top
notch (think: rust stdlib).
I think the rest of the module needs a simple overhaul,
but I was especially annoyed by having to reconstruct Middleware
from first principles every time I built a server (“which order
does it chain again?”).
Before submitting your PR, check that you've:
@sincedeclarations to the HaddockAfter submitting your PR: