我既是 Elm 又是函数式编程新手,从未认真使用过 Java。我正在阅读 Elm 文档,并使用 REPL,试图理解类型注释。
它们看起来非常有用:
type alias Point = { x:Float, y:Float }
origin : Point
origin =
{ x = 0, y = 0 }
现在您的所有积分都是专门格式化的浮点数!魔法。爱它。很想在 REPL 中使用它,但 REPL 似乎不理解类型定义:
> type alias Point = { x:Float, y:Float }
> origin : Point
-- SYNTAX PROBLEM -------------------------------------------- repl-temp-000.elm
I ran into something unexpected when parsing your code!
7│ origin : Point
^
I am looking for one of the following things:
end of input
whitespace
这是 REPL 中的错误还是功能?