Dmi*_*tri 10 read-eval-print-loop elm type-annotation
我既是榆树又是功能性编程新手,从未认真对待过Java.我正在通过Elm docs,并使用REPL,尝试理解类型注释.
它们似乎非常有用:
type alias Point = { x:Float, y:Float }
origin : Point
origin =
{ x = 0, y = 0 }
Run Code Online (Sandbox Code Playgroud)
现在所有的点都是专门格式化的浮点数!魔法.爱它.很想在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
Run Code Online (Sandbox Code Playgroud)
这是REPL中的错误还是功能?