elm-lang / elm-repl

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

Multiple lines do not work in elm 0.17 on windows 8.1 #115

Closed asunar closed 8 years ago

asunar commented 8 years ago
Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. All rights reserved.

C:\Users\ASunar>elm-repl
---- elm repl 0.17.0 -----------------------------------------------------------
 :help for help, :exit to exit, more at <https://github.com/elm-lang/elm-repl>
--------------------------------------------------------------------------------
> over9000 powerLevel = \
| if powerLevel > 9000 then "It's over 9000!!!" else "meh"

-- SYNTAX PROBLEM --------- elm-stuff\packages\elm-lang\core\3.0.0\src\Array.elm

I ran into something unexpected when parsing your code!

2|     ( Array
       ^
I am looking for one of the following things:

    something like `exposing (..)` which replaced `where` in 0.17
    whitespace
rudolfb commented 8 years ago

Here your example:

> over9000 powerLevel = \
| if powerLevel > 9000 then "It's over 9000!!!" else "meh"

Try the following:

> over9000 powerLevel = \
|   if powerLevel > 9000 then "It's over 9000!!!" else "meh"

Note the additional spaces in front of the if.

asunar commented 8 years ago

How many spaces should there be? I tried 1-5 spaces still getting the same error on windows 8.1

rudolfb commented 8 years ago

I had to enter 2 spaces to get this to work, admittedly on Linux.

Uninstalled Elm on my Windows 10 workstation, and deleted all directories that contained any elm references. Try a where elm on Windows to see where Elm is installed. Perhaps you have Elm installed in more than one place, as was the case on my Windows workstation.

Then installed Elm 0.17.0 . Had to create a new directory and

elm package install elm-lang/html

otherwise I got the error

C:\Users\rb>elm-repl
---- elm repl 0.17.0 -----------------------------------------------------------
 :help for help, :exit to exit, more at <https://github.com/elm-lang/elm-repl>
--------------------------------------------------------------------------------
> over9000 powerLevel = \
|    if powerLevel > 9000 then "It's over 9000!!!" else "meh"
Unable to find a set of packages that will work with your constraints.

This installed the necessary packages which elm-repl needs to run. If you have a look at the contents of an Elm 0.17.0 elm-package.json in the empty project, you will see the following:

{
    "version": "1.0.0",
    "summary": "helpful summary of your project, less than 80 characters",
    "repository": "https://github.com/user/project.git",
    "license": "BSD3",
    "source-directories": [
        "."
    ],
    "exposed-modules": [],
    "dependencies": {
        "elm-lang/core": "4.0.0 <= v < 5.0.0",
        "elm-lang/html": "1.0.0 <= v < 2.0.0"
    },
    "elm-version": "0.17.0 <= v < 0.18.0"
}

In your repl there is a reference to core version 3.0.0 . In the elm-package.json above the version number is 4.0.0 .

I think you have a dependency issue, ought to uninstall Elm completely and then re-install. Remember, you might have installed Elm using the installer, or npm install -g elm, or via chocolatey. Using where elm you can find out how and ensure it is gone before re-installing.

evancz commented 8 years ago

It's not a problem with the REPL or multiline things. Follow the advice from https://github.com/elm-lang/elm-repl/issues/118#issuecomment-229549477 and it should clear things up. If not, and the problem still exists with 0.17.1, open a new issue.