-
Notifications
You must be signed in to change notification settings - Fork 659
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
Elm Reactor should pass flags: null
#2251
Comments
Thanks for reporting this! To set expectations:
Finally, please be patient with the core team. They are trying their best with limited resources. |
Similarly,
means you can declare variables like this
If it was possible to have a fruit with no name, you could do:
This is how you'd use an Elm For flags, you need to do something a bit more involved in order to accept data with different shapes... I'm not super knowledgeable with the different techniques for decoding flags so I'll stop here and just drop the Elm guide's link on them for convenience: https://guide.elm-lang.org/interop/flags.html Hope this helps! |
@adamdicarlo Thanks for replying. That makes sense. Let me rephrase my example so I can get some clarity. What is this type known as, And if I rewrite my example, then would this expression make sense, type Startup = NoFlags () | Edit (Maybe Int) So what I'm looking for is the ability to do this, type Startup = NoFlags () | IntFlag (Maybe Int)
main: Program Startup Model Msg
... The reason is because this is valid, main: Program () Model Msg and this is valid, main: Program (Maybe Int) Model Msg But the reason the second example wouldn't work in the playground is because the playground doesn't pass in null as a flag parameter, and by extension the reactor does not pass null as well. But if you were to write the html on your own and pass null it would work. But if you don't pass anything (undefined), then So I guess the limitation here is that |
Quick Summary: To develop apps with JS-Interop it would be great if reactor would set init to null, so that on the Elm side you can declare main like
main: Program (Maybe <some-type>) Model Msg
.Currently it doesn't set any value which means that undefined is returned, and this error will be shown
SSCCE
Try this in playground --
On a side note, I sort of expected to be able to do this:
But that results in:
Which is reasonable, but seems a bit inconsistent when
()
compiles withProgram () Model Msg
.The text was updated successfully, but these errors were encountered: