Elm 中的保留关键字是什么?

What are the reserved keywords in Elm?

每隔一段时间你就会遇到这样的编译器错误:

It looks like the keyword `port` is being used as a variable.

真烦人。是否有这些关键字的完整官方列表?我已经找到了 where the error messages are generated,但找不到实际定义关键字的位置。

同时,这是我通过浏览 syntax 页面并在 repl 中尝试关键字发现的可能不完整或不正确的关键字列表:

根据elm-compiler source code the list of reserved keywords是:

keywords =
  Set.fromList
    [ "if", "then", "else"
    , "case", "of"
    , "let", "in"
    , "type"
    , "module", "where"
    , "import", "exposing"
    , "as"
    , "port"
    ]

编辑: 实际上还有一些关键字(由 searching for "reserved" 在 repo 中找到) 我发现:infixinfixlinfixrinfixr OP 也注意到了。

感谢@oustad(在 elmslack 上),可以得到正确的列表 here,它包含所有保留字(包括 whereinfix)。

module Parse.Primitives.Keyword
  ( type_, alias_, port_
  , if_, then_, else_
  , case_, of_
  , let_, in_
  , infix_, left_, right_, non_
  , module_, import_, exposing_, as_, where_, effect_
  , command_, subscription_
  , jsonTrue, jsonFalse, jsonNull
  )