【问题标题】:Type annotations in Elm REPL在 Elm REPL 中键入注释
【发布时间】:2015-12-19 21:10:22
【问题描述】:

我既是 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 中的错误还是功能?

【问题讨论】:

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


    【解决方案1】:

    榆树回复does not currently support type annotations。有很多人要求这个,所以我很快就会抱有希望。

    【讨论】:

    • 谢谢。这实在是太糟糕了。 Eml-reactor 非常棒,但我无法在我的 Emacs 中运行它,也无法通过输入函数名称来检查函数。但我会为你的回答投两票,因为你帮助我找到了github.com/elm-community
    • 查看elm-mode for emacs。 elm-oracle 集成为您提供了一些编辑器内检查功能
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-12-15
    • 2016-02-22
    • 1970-01-01
    • 2016-10-11
    • 1970-01-01
    相关资源
    最近更新 更多