elm / error-message-catalog

A catalog of broken Elm programs / data to improve error messages
BSD 3-Clause "New" or "Revised" License
174 stars 17 forks source link

No `-- comments` above module: isn't so clear for a beginner? #359

Open badlydrawnrob opened 9 months ago

badlydrawnrob commented 9 months ago

It took me a while to find out why this error message was complaining, working my way through Elm In Action:

-- RESERVED WORD  /elm-in-action/02/src/PhotoGroove.elm

I was not expecting to run into the `module` keyword here:

21| module PhotoGroove exposing (main)
    ^^^^^^
It is a reserved word. Try changing the name to something else?

Also took me a while to find this thread comment on no comments allowed above the module statement:

{-| Beginning our Elm app:
    Photo Groove!
-}

-- #1
module PhotoGroove exposing (main)

I don't think Python or Racket lang have this restriction and it may not be clear enough for complete beginners that it isn't allowed. I'm used to doing this in HTML/CSS also!

So please make the error message more helpful, and introduce documenting guidelines in the Elm guide on modules etc, I couldn't find this document easily:

The module documentation comes after the module declaration, but before the imports. This is so the first thing in the file is the module name and the second is how to use it.

Perhaps that could be worded a little better? `"comments must be written after the module declaration" or something.

Thanks.