Incorrect module name in .bkp instantiation causes a "Failed to load interface" error
When attempting to compile the following .bkp file:
unit basic where
signature Basic where
unit mod where
module Mod where
unit main where
dependency basic
[ Basic = mod:Nonsense ]
GHC produces the error:
ghc --backpack Error2.bkp
[1 of 3] Processing basic
[2 of 3] Processing mod
Instantiating mod
[1 of 1] Compiling Mod ( mod\Mod.hs, mod\Mod.o )
[3 of 3] Processing main
Instantiating main
[1 of 1] Including basic[Basic=mod:Nonsense]
Instantiating basic[Basic=mod:Nonsense]
[1 of 1] Compiling Basic[sig] ( basic\Basic.hsig, basic\basic-ER8okxhuIcsFJ32OYv1Qcp\Basic.o )
<no location info>: error:
Failed to load interface for `Nonsense'
There are files missing in the `mod' package,
try running 'ghc-pkg check'.
Use -v (or `:set -v` in ghci) to see a list of the files searched for.
It would be better to catch this problem earlier on, and report a proper error message.