elm - Elm 中 Url.Parser.custom 的第一个参数

标签 elm url-parsing

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的目的是什么? ?
  • 它有什么值(value)重要吗?
  • 最佳答案

    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/

    相关文章:

    Java URL 类 getPath()、getQuery() 和 getFile() 与 RFC3986 URI 语法不一致

    java - Java中的URL解析

    Elm 递归类型定义

    具有默认值的 Elm 类型别名

    Elm 获取原始 JSON 字符串

    php - 如何从 URL 字符串中获取参数?

    php - $_SERVER ['REQUEST_SCHEME' ] 可靠吗?

    elm - 如何 "read"Elm 的 -> 运算符

    json - 用 Elm 中的对象解码 Json 数组