I upgraded to 0.18 to 0.19 recently, and it was harder / more annoying than I was hoping for. There wasn’t always documentation for the things, and I spent a reasonable amount of time looking at code on GitHub to work things out. I used https://github.com/avh4/elm-upgrade, which was very helpful.
Is this something a lot of people experience? And / or are a lot of people stuck on 0.18? If so perhaps as a community we could invest some time in the docs and in elm-upgrade?
Here are some of the things that I learned that I think aren’t easily available.
eeue56/elm-html-test
is now elm-explorations/test
DateTime.parse
is gone, the nearest equivalent is Iso8601.toTime
, but it only works with Iso 8601 formatted dates (this might cause you a breaking change).
‘date’ is replaced by ‘datetime’ in ‘Json.Decode.Extra’, but it only works with Iso 8601 formatted dates (this might cause you a breaking change).
Date.Extra
is now Time.Extra
-
Date.Extra.toFormattedString
is gone, use date-format instead. -
Date.Extra.compare
is gone, but is trivial to implement -
Date.Extra.fromCalendarDate
is replaced byTime.Extra.partsToPosix
Some things in style-elements are different
-
Style.Color
is replacEd byColor.Color
-
Style.rgba
uses 0 - 1 to specify the color, whereasColor.rgba
used 0 - 255, so if all your colors are white, this is why.
Window.size
doesn’t exist any more, which I was using to get the initial window size. You now do this in javascript and pass in as a flag. Window.reSizes
is now Browser.Events.onResize
. This has width
and height
parameters instead of a Size
type.
Location
is repalced by Url
-
parsePath
is replaced byparse
-
absolute
is used to create urls, and does the encoding -
Http.decodeUri
becomesUrl.percentDecode
. The docs say not to use this and to useUrl
instead, but I didn’t find a way to persuade this to give me a human formatted string.
Browser.Key
is annoying, and causes code damage (it has benefits too). I created a ModelAndKey
type, and I try and limit the damage to as close to the entry point of the application as possible.
I used Browser.application
to take over the entire page, which requires some changes to the static pages.
- index.html requires
<body id="page-body">
instead of<div id="root"></div>
- index.js requires
import { Elm } from './Main.elm';
instead ofimport { Main ...
- index.js requires
Elm.Main.init({...})
instead ofMain.embed(document.getElementById('root'), {...})