Closed AdrianRibao closed 7 years ago
Thanks for the issue! Make sure it satisfies this checklist. My human colleagues will appreciate it!
Here is what to expect next, and if anyone wants to comment, keep these things in mind.
Do you mean parsing a route from a string rather than location? Or reverse routing as in getting the path from a Route
.
getRouteForPath : String -> Route
seems to be just parsing a path and giving you the route. The lib already does this when using parsePath
except that it expects a Location
not a String
.
Maybe you mean something like reverse: Route -> String
?
oh! sorry, yes, I meant from Route to string:
getRouteForPath : Route -> String
Actually I'm having serious problems understanding parsers and their signatures, I can't event think about how to create a function that reverses the path.
I'm doing it by hand, but it seems to be a redundant solution
pathFor : Page -> String
pathFor page =
case page of
Home ->
"#home"
Login ->
"#login"
Post id ->
"#post/" ++ toString id
It is not possible right now. Creating code that works like this is a research problem (Note: lens means something very particular in Nate's work. It is not the "popular" meaning, and the Haskell community uses the term "lens" to refer to something that is related only on the surface level.)
Hi,
Is it possible to use a parse to get the path?
For example, with this code:
is there an easy way to create a funcion like this:
getRouteForPath : String -> Route