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

No import syntax instruction between the compiler and package.elm-lang.org #185

Closed
willnwhite opened this Issue Jun 16, 2016 · 6 comments

Comments

Projects
None yet
2 participants
@willnwhite

willnwhite commented Jun 16, 2016

and package elm org doesn t help you with import syntax

Searching package.elm-lang.org doesn't turn up any guidance about how to use the import syntax, and I guess this is where it should be/be linked to (if not in the compiler's error message), given importing is about packages.

In this case, the answer was to put Html in exposing, and I think I found that out by playing around.

@willnwhite

This comment has been minimized.

Show comment
Hide comment
@willnwhite

willnwhite Jun 17, 2016

I now realise I could have put Model -> Html.Html Msg but I think my point is still valid.

willnwhite commented Jun 17, 2016

I now realise I could have put Model -> Html.Html Msg but I think my point is still valid.

@evancz evancz added the request label Jul 11, 2017

@evancz

This comment has been minimized.

Show comment
Hide comment
@evancz

evancz Jul 11, 2017

Member

Can you move this to https://github.com/elm-lang/error-message-catalog?

I think this is a good point, and I think it'd be best to handle it in the compiler.

Member

evancz commented Jul 11, 2017

Can you move this to https://github.com/elm-lang/error-message-catalog?

I think this is a good point, and I think it'd be best to handle it in the compiler.

@evancz evancz closed this Jul 11, 2017

@evancz

This comment has been minimized.

Show comment
Hide comment
@evancz

evancz Jul 11, 2017

Member

Actually, don't bother opening it in the error message catalog. I am fixing it now!

Member

evancz commented Jul 11, 2017

Actually, don't bother opening it in the error message catalog. I am fixing it now!

evancz added a commit to elm/compiler that referenced this issue Jul 11, 2017

Add a hint for canonicalization errors
Fix elm/package.elm-lang.org#185

The idea is that when folks have name errors, maybe they are new to Elm
and do not understand imports yet. Now they will get a nice link that
explains exactly how import, exposing, and as work together. It also
outlines the default imports.

Also make ModuleNotFound point exactly to the module name
@evancz

This comment has been minimized.

Show comment
Hide comment
@evancz

evancz Jul 11, 2017

Member

The new error message is like this:

-- NAMING ERROR ------------------- /Users/evan/Documents/pkgs/html/src/Html.elm

Cannot find variable `nod`

246|   nod "section"
       ^^^
Maybe you want one of the following?

    node
    not
    bdo
    code

Or maybe `import` works different than you expect? Learn all about it here:
<https://github.com/elm-lang/elm-compiler/blob/0.19.0/hints/imports.md>

The hint link goes here.

Member

evancz commented Jul 11, 2017

The new error message is like this:

-- NAMING ERROR ------------------- /Users/evan/Documents/pkgs/html/src/Html.elm

Cannot find variable `nod`

246|   nod "section"
       ^^^
Maybe you want one of the following?

    node
    not
    bdo
    code

Or maybe `import` works different than you expect? Learn all about it here:
<https://github.com/elm-lang/elm-compiler/blob/0.19.0/hints/imports.md>

The hint link goes here.

@willnwhite

This comment has been minimized.

Show comment
Hide comment
@willnwhite

willnwhite Jul 11, 2017

The link is great, especially the emphasis on using qualified imports, which I didn't learn until it bit me!

willnwhite commented Jul 11, 2017

The link is great, especially the emphasis on using qualified imports, which I didn't learn until it bit me!

@evancz

This comment has been minimized.

Show comment
Hide comment
@evancz

evancz Jul 11, 2017

Member

Thanks for reviewing it! I'm very excited for this improvement, perhaps unreasonably excited. Seems pretty subtle, but I bet it'll be hugely helpful for newcomers!

Member

evancz commented Jul 11, 2017

Thanks for reviewing it! I'm very excited for this improvement, perhaps unreasonably excited. Seems pretty subtle, but I bet it'll be hugely helpful for newcomers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment