Improve error message when reading invalid `.target` files
A .target
file generated by ghc-toolchain or by configure can become
invalid if the target representation (Toolchain.Target
) is changed
while the files are not re-generated by calling ./configure
or
ghc-toolchain
again. There is also the issue of hadrian caching the
dependencies on .target
files, which makes parsing fail when reading
reading the cached value if the representation has been updated.
This patch provides a better error message in both situations, moving
away from a terrible Prelude.read: no parse
error that you would get
otherwise.
Fixes #24199 (closed)
Edited by Rodrigo Mesquita