I’ve upgraded my fully functional elm code from v0.18 to v0.19 - and I got this error:
I cannot find a `Html.programWithFlags` variable:
21| Html.programWithFlags
What happened to this feauture ? is there a workaround ?
I’ve upgraded my fully functional elm code from v0.18 to v0.19 - and I got this error:
I cannot find a `Html.programWithFlags` variable:
21| Html.programWithFlags
What happened to this feauture ? is there a workaround ?
Please have a look at https://github.com/elm/compiler/blob/master/upgrade-docs/0.19.md. You now need to use Browser.sandbox
.
Elm has gone through a pretty big restructuring since 0.18. One change that’s key in your case is the transfer of browser related functions (programWithFlags and the like) from Elm-lang/Html to Elm/Browser. Since your code needed flags, you’ll need to update to something like Browser.element (for a, as you may have guessed, element) or Browser.application (for an SPA.)
Remember, as you go through the upgrade process here, that Elm is a beta language. Breaking changes like this were always going to happen. These changes represent really important structural changes that make Elm one of, if not the fastest virtual dom diffing browser languages. With the new --optimize flag, it’s now the language with the smallest file size too.
I’ve read the changelog
* Html.beginnerProgram
becomes Browser.sandbox
.
* Html.program
becomes Browser.element
and Browser.document
.
Is there a drop-in replacement for the flags I’m feeding my application from the server?
I misread your question. You probably want to use Browser.element
, see https://package.elm-lang.org/packages/elm/browser/latest/. It explains the options you have.
In the type signatures for Browser.element/document/application
all of the init
functions now take flags as an argument, so there’s no longer a need for a separate “with flags” version of any of them.
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.