Could not load module error incorrectly suggests main library
E.g. when I try to load the module in GHCi:
<no location info>: error: [GHC-87110]
Could not load module ‘FormatPage’.
It is a member of the hidden package ‘lsm-tree-0.1.0.0:prototypes’.
You can run ‘:set -package lsm-tree’ to expose it.
(Note: this unloads all the modules in the current scope.)
GHC suggests :set -package lsm-tree
which is wrong (except if it loads all units matching the package, but it's also not great).
GHC knows the unit is not a main module:
% ghc-pkg-9.8.2 --package-db dist-newstyle/packagedb/ghc-9.8.2 describe z-lsm-tree-z-prototypes-0.1.0.0
name: z-lsm-tree-z-prototypes
version: 0.1.0.0
package-name: lsm-tree
lib-name: prototypes
The package-name
and lib-name
are different.
Similarly, when building
src/Database/LSMTree/Monoidal.hs:91:1: error: [GHC-87110]
Could not load module ‘FormatPage’.
It is a member of the hidden package ‘lsm-tree-0.1.0.0:prototypes’.
Perhaps you need to add ‘lsm-tree’ to the build-depends in your .cabal file.
the lsm-tree
is incorrect, GHC should suggest lsm-tree:prototypes
.