Are you sure you get that message on 9.4? I get it on 8.10 but on 9.0 and above I get a correct message:
% ghc-8.10 --make test17.hs
Could not load module ‘Opaleye’
It is a member of the hidden package ‘opaleye-0.9.6.1’.
You can run ‘:set -package opaleye’ to expose it.
% ghc-9.0 --make test17.hs
test17.hs:6:1: error:
Could not find module ‘Opaleye’
Use -v (or `:set -v` in ghci) to see a list of the files searched for.
(I used Opaleye rather than GHC.Compact since it seems that GHC.Compact is wired-in in 9.0 and above, at least ghc didn’t have any problems finding it.)
Oh, I beg your pardon. The difference was because I didn’t have any installed version of opaleye under the other GHCs. I now see what you see. This seems like a GHC bug to me.
Using ghc ... -package somepackage only works if somepackage has already been installed. So for packages that are not distributed with GHC you would need to run some form of cabal ... command every time you switch to a new GHC version.
I wonder how other ecosystems deal with this. I believe Rust doesn’t even allow using dependencies without making a crate (the Haskell equivalent would be a cabal package). But maybe other languages generally don’t use as many dependencies as Haskell.
Once a year maybe, so that’s OK for the benchmarks game.
other ecosystems
For Rust someone showed me cargo commands to download and build the latest versions of a programs dependencies. That expanded into a shell script and I jump through hoops making it work.
For Perl I’ve given up on a couple of benchmarks game programs because they pull in a build system with a seemingly bottomless pit of dependencies.
Of course, these things may work very well for their intended audience.
Meanwhile is:
Could not find module ‘Control.Concurrent.ParallelIO.Global’
One complication now is that as far as I know there is no cabal command to install a package without exposing it in a package environment file. So you can run cabal install --lib --package-env ./env parallel-io and then just discard the generated ./env file and use ghc -package parallel-io ... instead.
You could also save those env files for every benchmark somewhere and just use ghc -package-env ./env ... to compile. That avoids the ugliness with multiple packages, but it requires some extra management of those files.
Finally, one other alternative is to just run cabal install --lib parallel-io, which installs it into an environment that is always read by default. This avoids the ugly command line arguments and does not require you to manage environment files. However, this can lead to very confusing error messages if you are trying to install packages that conflict with packages that were installed earlier. So, it is generally not recommended, but maybe that isn’t so much of a problem in this case.
$ cabal install --lib text
Resolving dependencies...
Up to date
But
knucleotide.ghc-3.hs:33:1: error:
Could not find module ‘Text.Builder’
Use -v (or `:set -v` in ghci) to see a list of the files searched for.
|
33 | import qualified Text.Builder as Builder
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Also I was trying to avoid being online when time measurements were being made, by downloading required libraries beforehand.