Elm图形。输入

Elm图形。输入,elm,Elm,我正在尝试从运行Elm输入示例。具体来说,就是这个例子,我得到一个错误,说Graphics.Input模块丢失了 我在一个名为Main.elm的文件中找到了这个: import Graphics.Input as Input main = let (field, state) = Input.field "Type here!" in lift2 display field state display field state = field `above` asText

我正在尝试从运行Elm输入示例。具体来说,就是这个例子,我得到一个错误,说
Graphics.Input
模块丢失了

我在一个名为
Main.elm
的文件中找到了这个:

import Graphics.Input as Input

main = let (field, state) = Input.field "Type here!"
       in  lift2 display field state

display field state =
  field `above` asText state
如果我运行
elm服务器
并导航到
localhost:8000
,我会得到错误信息

Your browser may not be supported. Are you using a modern browser?

Runtime Error in Main module:
Error: Module 'Graphics.Input' is missing. Compile with --make flag or load missing module in a separate JavaScript file.

The problem may stem from an improper usage of:
Input.field, above
Your browser may not be supported. Are you using a modern browser?

Runtime Error in Main module:
TypeError: a is undefined

The problem may stem from an improper usage of:
above
使用
elm--makemain.elm
编译项目给了我

elm: Graphics/Input.elm: openFile: does not exist (No such file or directory)
安装
Graphic.Input
,我还需要做些什么吗

附加说明:

  • 我在Debian机器上运行这个,最近(2013年6月15日)使用
    cabal install elm
    安装了它。当前版本的标签为
    Elm-0.7.1.1
  • 如果我跳进
    chromium
    JS提示符并四处查看,结果发现没有
    Elm.Graphics.Input
    模块,但有一个
    Elm.Input
    。没有一个函数名为
    field
    ,有一个类似的函数名为
    textField
    ,但它不是可以互换的
运行此:

import Input

main = let (field, state) = textField "Type here!"
       in  lift2 display field state

display field state =
  field `above` asText state
告诉我错误

Your browser may not be supported. Are you using a modern browser?

Runtime Error in Main module:
Error: Module 'Graphics.Input' is missing. Compile with --make flag or load missing module in a separate JavaScript file.

The problem may stem from an improper usage of:
Input.field, above
Your browser may not be supported. Are you using a modern browser?

Runtime Error in Main module:
TypeError: a is undefined

The problem may stem from an improper usage of:
above

Graphics.Input
包在中是新的。因此,由于您运行的是0.7版,这就解释了您的问题


0.8是最近发布的,但它的发布时间肯定比6月15日要长,所以您可能只是忘记了在安装它之前进行
cabal更新。时不时地运行
cabal update
将elm更新为0.8应该可以解决您的问题。

您是什么时候安装elm的?刚才还是很久以前?您安装了哪个版本?几天前。
.cabal/share
中的文件夹名为
Elm-0.7.1.1
,因此我假设这就是我得到的版本。用附加注释更新了问题。