Skip to content

9.2.1 regression: compile of import of module installed by cabal install fails

9.2.1 regression: After installing the vector package, compile of file with "import Data.Vector" fails:

 ghc --version
The Glorious Glasgow Haskell Compilation System, version 9.2.1
bash-3.2$ cabal --version
cabal-install version 3.4.0.0
compiled using version 3.4.0.0 of the Cabal library 
bash-3.2$ cabal install vector --lib
Warning: Unknown/unsupported 'ghc' version detected (Cabal 3.4.0.0 supports
'ghc' version < 9.1): /usr/local/bin/ghc is version 9.2.1
Warning: Unknown/unsupported 'ghc' version detected (Cabal 3.4.0.0 supports
'ghc' version < 9.1): /usr/local/bin/ghc is version 9.2.1
Resolving dependencies...
Build profile: -w ghc-9.2.1 -O1
In order, the following will be built (use -v for more details):
 - primitive-0.7.3.0 (lib) (requires download & build)
 - vector-0.12.3.1 (lib) (requires download & build)
Downloading  primitive-0.7.3.0
Downloaded   primitive-0.7.3.0
Downloading  vector-0.12.3.1
Starting     primitive-0.7.3.0 (lib)
Downloaded   vector-0.12.3.1
Building     primitive-0.7.3.0 (lib)
Installing   primitive-0.7.3.0 (lib)
Completed    primitive-0.7.3.0 (lib)
Starting     vector-0.12.3.1 (lib)
Building     vector-0.12.3.1 (lib)
Installing   vector-0.12.3.1 (lib)
Completed    vector-0.12.3.1 (lib)
bash-3.2$ cat buggc.hs

import Data.Vector

main = undefined
bash-3.2$ ghc buggc.hs
[1 of 1] Compiling Main             ( buggc.hs, buggc.o )

buggc.hs:2:1: error:
    Could not find module ‘Data.Vector’
    Perhaps you meant Data.Functor (from base-4.16.0.0)
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
  |
2 | import Data.Vector
  | ^^^^^^^^^^^^^^^^^^

bash-3.2$ sw_vers
ProductName:	macOS
ProductVersion:	12.0.1
BuildVersion:	21A559

This worked in ghc 9.0.1. The workaround is to do "cabal v1-install vector". Since the version of Cabal used in both cases is the same I filed the bug against ghc as that is what changed.

Edited by george.colpitts
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information