Url.Parser.custom
的文档举个例子:
int : Parser (Int -> a) a
int =
custom "NUMBER" String.toInt
但是不要说明什么
"NUMBER"
是用来。我查了 the source它似乎被捕获为
tipe
,但从未使用过: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 ->
[]
所以:
tipe
的目的是什么? ? 最佳答案
Evan 在以下 GitHub 问题中解决了这个问题:https://github.com/elm/url/issues/6
tl;dr: It does nothing but is there for future use.
关于elm - Elm 中 Url.Parser.custom 的第一个参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55254205/