-
Notifications
You must be signed in to change notification settings - Fork 367
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
Exporting Union Types in Elm Syntax #523
Comments
It is mentioned here Elm Syntax — Modules already, but I agree, it is not explicit. The best I could think of is adding a commentary about the presence of open imports for Union Types in Modules section. |
I think it should be mentioned here too: https://guide.elm-lang.org/types/union_types.html |
Yeah, this is mysterious to a beginner and not emphasized enough in the docs (or at least not enough that I remembered it). This github issue saved me :-) |
Glad I found this github issue, because I couldn't deduct this from Elm Syntax - Modules |
Puh I am so happy to have seen this issue... Now all my Types go into a single Types.elm |
This was a good 30 minutes of headache for me... glad this issue is the first result when you google it. |
For anyone looking here. Export your union type with |
I somehow knew that importing it with (..) was possible, but I didnt think of exporting for some reason. ¯_(ツ)_/¯ |
This means that you can't access |
If we have a submodule with:
type Animal = Cat | Dog
we can export Cat and Dog with:
module Submodule (Animal(..)) where
and import with
import Submodule exposing (Animal(..))
Can we add something that explains this on the syntax page
The text was updated successfully, but these errors were encountered: