The docs for Url.Parser.custom
give an example:
int : Parser (Int -> a) a
int =
custom "NUMBER" String.toInt
But don't indicate what "NUMBER"
is used for.
I checked the source and it seems to be capture as tipe
, but never used:
custom : String -> (String -> Maybe a) -> Parser (a -> b) b
custom tipe stringToSomething =
Parser <| \{ visited, unvisited, params, frag, value } ->
case unvisited of
[] ->
[]
next :: rest ->
case stringToSomething next of
Just nextValue ->
[ State (next :: visited) rest params frag (value nextValue) ]
Nothing ->
[]
So:
- What is the purpose of
tipe
? - Does it matter what value it has?