Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

is module declaration mandatory? #270

Open
code-sur opened this issue Jan 22, 2022 · 0 comments
Open

is module declaration mandatory? #270

code-sur opened this issue Jan 22, 2022 · 0 comments

Comments

@code-sur
Copy link

code-sur commented Jan 22, 2022

  • My programming background is: Professional developer, 15 years working in industry, generalist.
  • I want to learn Elm because: I like trying new languages, Brian Marick usually tweets about Elm and I've never used a fully functional language
  • I was confused by:

The very first example of the guide does not compile: Introduction -> A Quick Sample
By just copy-paste the sample in a file (Main.elm) you get the following:

$ elm --version
0.19.1
$ elm make src/Main.elm 
Detected problems in 1 module.
-- MODULE NAME MISSING -------------------------------------------- src/Main.elm

I need the module name to be declared at the top of this file, like this:

    module Main exposing (..)

Try adding that as the first line of your file!

Note: It is best to replace (..) with an explicit list of types and functions
you want to expose. When you know a value is only used within this module, you
can refactor without worrying about uses elsewhere. Limiting exposed values can
also speed up compilation because I can skip a bunch of work if I see that the
exposed API has not changed.

It is not a big deal I know, one can just add the missing module line as the compiler suggests and it works but it didn't feel good having a compilation error in the first try of the hello world example

Later in Web Apps -> Modules it says:

image

Is that note valid? If it is, in which context? It doesn't seem to be valid with elm make or elm reactor

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant