elm / compiler

Compiler for Elm, a functional language for reliable webapps.
https://elm-lang.org/
BSD 3-Clause "New" or "Revised" License
7.51k stars 657 forks source link

Confusing error message in elm reactor when missing main #2093

Open brainrake opened 4 years ago

brainrake commented 4 years ago

Quick Summary: When loading a module without a main function from elm reactor, the following error message is displayed:

Initialization Error

ReferenceError: _Platform_export is not defined

A better message would include a hint, eg.

Did you forget to define a main value?

SSCCE

module Main exposing (..)

a = 0

Additional Information:

Running elm make on a file with no main results in a great error message.

edit: clarify, add additional information

github-actions[bot] commented 4 years ago

Thanks for reporting this! To set expectations:

Finally, please be patient with the core team. They are trying their best with limited resources.

jessbowers commented 3 years ago

This makes elm reactor confusing for beginners. That's what i'm experiencing now. There isn't easy documentation about getting started with reactor to begin with -- it's a little too simple in the guide. I don't know what to expect when pointing at my "non-main" elm module file. So this change would help that, IMO.

nilslindemann commented 3 years ago

Actually I like that oneliner in the docs: "use elm reactor". How could it be simpler? And what would you need more? "For more info use elm --help"?

meltingscales commented 2 years ago

Just found this thread, thank god - Learning Elm, this error is extremely confusing - Perhaps a warning can be thrown sometime during compilation?