Comments (3)
+1 I struggled with this quite a bit when starting off. Only issue I'm thinking is that if you have something like
import Element
import Element.Background
import Element.Border
Is there a risk that beginners will just copy the whole thing into their module when they only need import eg Element
?
from package.elm-lang.org.
I think the risk is high that beginners will copy the whole thing indeed, and because a lot of code examples assume exposing (..)
, particularly core libraries, this would not help much anyway.
Also, with regard to the examples above, the 4th line of elm/html
documentation shows an import example:
https://package.elm-lang.org/packages/elm/html/latest/
Idem for elm-ui
in the example just after the introduction:
https://package.elm-lang.org/packages/mdgriffith/elm-ui/latest/
If this did not help, why adding them again in the About
page would?
In my opinion, they are better illustrated by code examples that include the import
directives to show why the names are qualified, or not, or with an alias.
But to explain them at first, I think it would be better to fix the "Using Packages" link and explain how to install and import in this documentation (including as
and exposing (..)
).
- Maybe this could point to an updated version of https://github.com/elm-lang/elm-package/blob/72c69fcdc5b21cb9035f081dbbc79db4401fe817/README.md, with a new section about import.
- Or maybe this could point to the Elm guide section about installing packages, that would be completed with a basic explanation of
import
:
https://guide.elm-lang.org/install/elm.html#elm-install
from package.elm-lang.org.
Yes, sometime package authors add example that also include the imports, but it is not always the case, so I think an example generated automatically could be a safer approach.
Having begineers copying all the imports, even if not necessary, seems to me a minor issue compared to have them struggling in making their code to work. At least the code is running. They will eventually learn and most IDE now have warnings for unused imports.
About explaing about importing modules, this could be a good target: https://elm-lang.org/docs/syntax#modules
from package.elm-lang.org.
Related Issues (20)
- Switch to self-hosting fonts HOT 1
- Site does not show contents on Firefox HOT 2
- Cannot publish a 0.18 package HOT 3
- Can't link to top of module documentation page HOT 1
- Unpublish special-elektronik/elm-autocomplete due to organisation name change HOT 2
- Code highlighting broken when starting with module
- add dark mode HOT 3
- Can't build the backend server with Cabal
- Add documentation on how to build the backend server
- Add a page that lists packages published by a single author HOT 1
- Namespace organization
- Add a maintainer page, listing all packages maintained/owned by someone HOT 2
- package.elm-lang.org uses expired DST Root X3 certificate HOT 5
- Deleted Package HAN-ASD-DT/priority-queue
- Promote jfmengels/elm-review in package search results for "elm-review"
- Request to support query parameter for search query
- how to build?
- Limit for docs.json too low HOT 1
- READMEs only supported as Markdown
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from package.elm-lang.org.