Question

I'm trying to run the Elm input examples from this page. Specifically, the Text Field example, and I'm getting an error saying that the Graphics.Input module is missing.

I've got this in a file called 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

If I run elm-server and navigate to localhost:8000, I get the error

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

Compiling the project with elm --make Main.elm gives me

elm: Graphics/Input.elm: openFile: does not exist (No such file or directory)

Is there something extra I need to do to install the Graphic.Input?

Additional Notes:

  • I'm running this on a Debian machine, and installed it using cabal install elm fairly recently (Jun 15 2013). The current version is labeled Elm-0.7.1.1.
  • If I hop into the chromium JS prompt and poke around, it turns out there's no Elm.Graphics.Input module, but there is an Elm.Input. There isn't a function called field, there's a similar looking one called textField, but it isn't trivially interchangeable.

Running this:

import Input

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

display field state =
  field `above` asText state

gives me the error

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
Était-ce utile?

La solution

The Graphics.Input package is new in version 0.8. So, since you're running version 0.7, that explains your problem.

0.8 was released somewhat recently, but it's definitely been out longer than June 15th, so you probably just forgot to cabal update before installing it. Running cabal update now and then updating elm to 0.8 should fix your issue.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top