read-eval-print-loop - Elm REPL中的类型注释

标签 read-eval-print-loop elm type-annotation

我既是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/

相关文章:

lambda - Common Lisp 中的 lambda 表达式是宏还是标记?

clojure - 运行独立 clojure REPL 的推荐方法是什么?

elm - 相互依赖的信号

elm - 从 Elm 端口检索 DOM 值

java - 使用 Java 7 类型注释 (JSR 308)?

namespaces - Clojure : missing namespace errors when running "use" at the REPL

lisp - CLISP 的 REPL 中有哪些魔法变量?

dictionary - 从记录列表生成字典

python-3.x - 类型注释: Extract inner type from container type

python-3.x - Bytes-like object 或 Buffer 类型注解