Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- From the location below, I'd like to get the `page` param:
- ```
- > location
- { href = "", host = "", hostname = "", protocol = "", origin = "", port_ = "", pathname = "/admin/sites/91c2a015-6f2c-47fc-bc76-c136e2401058/residents", search = "?page=2", hash = "", username = "", password = "" }
- : Navigation.Location
- ```
- Currently I can parse it using this location (without the UUID):
- ```
- > another_location
- { href = "", host = "", hostname = "", protocol = "", origin = "", port_ = "", pathname = "/admin/sites/residents", search = "?page=2", hash = "", username = "", password = "" }
- : Navigation.Location
- > parsePath (s "admin" </> s "sites" </> s "residents" <?> intParam "page") another_location
- Just (Just 2) : Maybe.Maybe (Maybe.Maybe Int)
- ```
- But I'm having difficulties handling the UUID:
- ```
- > parsePath (s "admin" </> s "sites" </> string </> s "residents") location
- Just "91c2a015-6f2c-47fc-bc76-c136e2401058" : Maybe.Maybe String
- > parsePath (s "admin" </> s "sites" </> string </> s "residents" <?> intParam "page") location
- -- TYPE MISMATCH --------------------------------------------- repl-temp-000.elm
- The 1st argument to function `parsePath` is causing a mismatch.
- 6| parsePath (s "admin" </> s "sites" </> string </> s "residents" <?> intParam "page") location
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- Function `parsePath` is expecting the 1st argument to be:
- Parser (String -> String) String
- But it is:
- Parser (String -> Maybe Int -> String) String
- Hint: It looks like a function needs 1 more argument.
- ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement