elm - Html.elm elm 0.18 中不允许使用单引号

标签 elm

大家好,榆树有一个奇怪的问题。

刚刚将 elm 表单从 0.17 更新到 0.18。
项目在 0.17 中运行良好
现在编译器在 018 中抛出错误。

他就是这么说的:

-- SYNTAX PROBLEM ---------- elm-stuff/packages/elm-   lang/html/1.1.0/src/Html.elm

Ran into a single quote in a variable name. This was removed in 0.18!

9|   , section, nav, article, aside, header, footer, address, main', body                                                                  ^
Change it to a number or an underscore, like main_ or main1
Or better yet, choose a more descriptive name!

其他人有这个问题吗?

可能是什么问题:我已经在使用“main”了
main : Program Never

Elm 好像有问题,因为 Html 也有 main 函数。。
可能是这种情况吗?

亲切的问候

马丁

最佳答案

根据您的错误消息,您似乎引用的是 elm-lang/html 的旧版本。包裹。您需要升级到 latest version .

旧的源代码有一个 function called main' ,这是在 0.18 升级后导致问题的原因。 Elm 0.18 中删除了单引号或素数。这是埃文来自 blog post about the 0.18 release 的评论:

Primes — Names like x' are no longer permitted. A younger me (one who was less concerned about nice variable names) certainly thought writing “x prime” was pretty neat! But in general, this syntax is too confusing to be worth it. Single quotes are generally associated with strings and characters. To see it unbalanced and part of a variable throws people off, and the benefit of having it is pretty small.

关于elm - Html.elm elm 0.18 中不允许使用单引号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40694965/

相关文章:

Elm 标记联合类型比较构造函数

elm - 在 Elm 中,如何检测相对于 html 元素的鼠标位置?

polymorphism - 长度示例中 "a"中的 "List a"是什么?

elm - 编译没有错误的简单程序给出一个白页

date - 用当前日期初始化模型

algorithm - 在 Elm 中将 List (Maybe a) 转换为 Maybe (List a)

clojurescript - Elm 与 ClojureScript 相比如何?

functional-programming - 使用条件查询参数构建 URL

datetime - 给定 IANA 时区和本地时间,将其解析为 Maybe Posix?

json - Elm 简单 JSON 列表解码