我既是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中的错误还是功能?
最佳答案
榆树repl does not currently support type annotations。有很多人要求这样做,所以我对它抱有希望。
关于read-eval-print-loop - Elm REPL中的类型注释,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34375446/