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

Single quote not allowed in 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', which was causing the problem after the 0.18 upgrade. The single quote, or prime, was removed in Elm 0.18. Here's Evan's comment from the 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 0.18 之后,我今天 运行 这些示例出现了问题。解决方案是删除 elm-stuff 目录并重新启动 elm-reactor 以下载最新的软件包,包括 html-2.0.0