我既是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中的一个bug还是一个功能?