Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I cannot find module 'Graphics.Element'

Tags:

elm

I am trying to play around with Elm (0.17) a little bit. But I can't get this simple example running:

import Graphics.Element exposing (..)

main =
  show "Hello!"

The following error is shown when running elm reactor:

I cannot find module 'Graphics.Element'.

Module 'Main' is trying to import it.

Potential problems could be:

  • Misspelled the module name
  • Need to add a source directory or new dependency to elm-package.json

I did run elm package install evancz/elm-graphics and it was successfully. I also see it when opening localhost:8000 under the Dependencies Sidebar.

When looking at other examples they doing the import the same way.

What could cause the problem?

like image 849
Bene Avatar asked May 17 '16 18:05

Bene


2 Answers

In version 0.17, The module name has changed to Element and you'll need to convert Graphics elements to Html now. Try changing your code to the following:

import Element exposing (..)

main =
  toHtml <| show "Hello!"
like image 149
Chad Gilbert Avatar answered Oct 27 '22 02:10

Chad Gilbert


According to the current elm-lang.org/examples hello-html is now written as

import Html exposing (text)

main =
  text "Hello!"
like image 42
user2250342 Avatar answered Oct 27 '22 03:10

user2250342