-
Notifications
You must be signed in to change notification settings - Fork 38
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
Understanding on what lit
and src
behaviors
#41
Comments
The parser matches on slugs in between slashes (or rather, it's tokenized using slashes as delimiters). |
i see.. so we need the lit "" only at the first time, not every And also it means, we cannot parse if there isn't any
as there is not |
I think that |
@natefaubion noted and thank you.. |
@natefaubion, continuing my chat in slack, and trying to avoid slack archive.. i'll put my reply in here.
Here is the guide said:
I just want to correct my logic in how purescript-routing act. So, my understanding is, the library trying to match the uri address with the pattern we describe in
routing :: Match a
function. How it works is it stripped the uri address (let saymysite.com/#/foo/bar/FooBar
) until the#
sign.So, we will have
#/foo/bar/FooBar
, which in this case, if we use the above guide,lit "x" matches "/x"
and"str" matches "/foo" as "foo"
, then the stripped address can be matched with this:but instead, i have to do this:
and if we see the guide again, it looks like it is "//foo//bar//FooBar". I know that we use
<*
or*>
that supposed to remove thelit ""
. But why can't we just use the former example one??? I mean why we can't just write it :FooBarPage <$ (lit "foo" *> lit "bar" *> lit "FooBar" )
Instead of:
FooBarPage <$ (lit "" *> lit "foo" *> lit "" *> lit "bar" *> lit "" *> lit "FooBar" )
the same goes if we have
FooBarPage String
, by using the guide again, we supposed to write:FooBarPage <$> (lit "foo" *> lit "bar" *> lit "" *> lit "FooBar" )
instead of
FooBarPage <$ (lit "" *> lit "foo" *> lit "" *> lit "bar" *> lit "FooBar" )
Right? I am sorry if my understanding is not what the guide supposed to mean. But from beginner pov (like me), reading the source's comment explanation is very helpful (well i have to try and error by building it though for better understanding).
Anyway, this is just me trying to visualise what the lib do.
The text was updated successfully, but these errors were encountered: