We previously had to fix a corrupt Map by changing it to a List and then back
into a Map. It turns out we had to do this because the original data structure
on disk wasn't a Map to begin with, but a List. It was previously assumed to be
a Map by the compiler because the first function that it was passed to took a
type of `Interfaces` which is a Map of interface definitions. Unfortunately this
didn't cause a runtime error when Haskell found out that the structure wasn't
deserialized into a Map. Instead Haskell happily created a broken Map that
couldn't find members some of the members that it contained (it could find
somewhere around the first half of its members, but the second half it reported
as missing when they were clearly present).
Changing the type of the first function that the deserialized structure is
passed to from a Map (actually Interfaces which is a type of Map) to a List
allows Haskell to infer the correct type to deserialize into and makes
everything work as expected.
Provides an error message indicating incorrect compiler version or corrupt file.
Exit status will be 1 in either failure case and error message is printed to
stderr. Uses the same checks against interfaces.data as well as standard .elmi
files since both are susceptible to breaking in the same way.
The following will be displayed when an elmi file has a different compiler
version than the elm compiler that tries to load it:
justin ~/Code/elm-lang.org/public/examples/Intermediate $ ~/Code/elm/dist/build/elm/elm Pong.elm
Found build artifacts created by a different Elm compiler version. Please rebuilt cache/Pong.elmi and try again.
The following will be displayed when a file that cannot be deserialized is
encountered:
justin ~/Code/elm-lang.org/public/examples/Intermediate $ ~/Code/elm/dist/build/elm/elm Pong.elm
Got an error, 'demandInput: not enough bytes' at offset 10303 of cache/Pong.elmi.
This error may be due to an outdated or corrupt artifact from a previous build. Please rebuild cache/Pong.elmi and try again.
constructors could be shadowed by user defined ADT's such as "Tuple0",
"Tuple2", etc. Now it uses "_Tuple0" to make it impossible to overlap
with user defined ASTs.