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

Simplify RoutePattern type #156

Closed
wants to merge 242 commits into from

Conversation

bmjames
Copy link

@bmjames bmjames commented Mar 10, 2015

This is a proof-of-concept intended to provoke some discussion about why the RoutePattern data type is as it is, and whether it can be modified to give users more power to write modular routing code.

I would like to write combinators for RoutePatterns, but it isn't possible to do anything very useful without duplicating the code that is in the internal function matchRoute. Examples of useful RoutePattern combinators would be matching either of two patterns, or both.

However, I noticed that matchRoute turns any RoutePattern into a function that would fit in the Function constructor. So, why do we need the other constructors?

This patch shows that if we move the logic from matchRoute out into the capture and literal functions, then the need for the various RoutePattern ADT constructors vanishes, and thus users' own combinators for routes no longer need to handle the different cases of RoutePattern.

Andrew Farmer and others added 30 commits April 12, 2012 14:38
Adding new route matching data-type "RoutePattern".
but scotty.cabal does not depend on wai-extra, add documentation
…onse

Add "source" function to construct response directly from a Source
Document that basic.hs imports Network.Wai.Middleware.RequestLogger which requires wai-extra
sol and others added 26 commits November 11, 2014 22:24
this is relevant to issue scotty-web#131
in current implementation it is still usafe to mix
body/jsonBody and bodyReader
this makes it safe to call body(or something that uses it) and
then use bodyReader. Calling bodyReader will cause subsequent calls
to body to result in a BodyPartiallyStreamed exception.

still a bit rough around the edges and might require some exception
handling when working with mvars (bracket).

fixes scotty-web#131
hlint suggestion
Add instance Parsable LazyByteString
Add comment in basic.hs for next
Add scottySocketT and scottySocket, exposing Warp Unix socket support
Use data-default-class instead of data-default
@chessai
Copy link
Contributor

chessai commented Dec 19, 2019

this PR is massive and unreviewable by me. closing, but i will open an issue for me to investigate.

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

Successfully merging this pull request may close these issues.