elm-lang / elm-repl

A REPL for Elm
BSD 3-Clause "New" or "Revised" License
170 stars 34 forks source link

Run elm-http zipcode program via elm-repl #72

Closed ghost closed 9 years ago

ghost commented 9 years ago

I am trying to run the zipcode program at https://github.com/evancz/elm-http without compiling it into browser. I saved in an elm file.. and entered elm-repl mode. Then, i tried to import my elm source file via "import pincode". It throws error as,

Elm REPL 0.4 (Elm Platform 0.15)
  See usage examples at <https://github.com/elm-lang/elm-repl>
  Type :help for help, :exit to exit
> import pincode
Problem parsing imports in file repl-temp-000.elm (line 2, column 8):
unexpected "p"
expecting whitespace, a newline or upper case variable

There is probably a problem with the syntax of your imports. For example,
import syntax was changed a bit from 0.14 to 0.15:

    0.14: import Html (..)
    0.15: import Html exposing (..)

See <http://elm-lang.org/learn/Syntax.elm> for more info.
jvoigtlaender commented 9 years ago

Something like import pincode cannot be right. Module names in Elm are always uppercase. Maybe your file has the name pincode.elm, but a module cannot. So you may have to rename the file. You will also have to actually put something like module Pincode where at the top of that file. Finally, have you tried to actually run :help in the REPL, to let it help you by explaining the commands it is able to execute?

ghost commented 9 years ago

it works, after making p in pincode to be in Caps, and adding module Pincode where on the top... But it is not giving me a decoded places object

> import Pincode
> Pincode.lookupZipCode "12345"
<internal structure> : Task.Task Http.Error (List String)

But still closing this issue....

evancz commented 9 years ago

Ah, so right now the REPL does not run a task that you give it. It is just showing you the task value.

We are working on getting Elm working with node.js more, so this seems like a nice potential improvement. Can we open an issue for "Request: entering tasks should run the task" and discuss the implications of this there?