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 #254

Open
chessai opened this issue Dec 19, 2019 · 0 comments
Open

simplify RoutePattern type #254

chessai opened this issue Dec 19, 2019 · 0 comments

Comments

@chessai
Copy link
Contributor

chessai commented Dec 19, 2019

see #156 :

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.


commit of interest : 01906eb

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

2 participants