Skip to content

ghc and ghci don't read the default package environment file on Windows

Summary

According to the package environments section of the User Guide, ghc and ghci invocations should use the $HOME/.ghc/arch-os-version/environments/default package environment file if it exists and no specific options have been given to the contrary.

This works correctly on Linux, but the file is not being found on Windows.

On my machine, the default package environment is located at C:\Users\myuser\.ghc\x86_64-mingw32-8.10.3\environments\default.

Steps to reproduce

Create a package environment file in the default location. The simplest way is to install a library with cabal install --lib:

cabal install --lib sop-core

Then, in an empty folder, start ghci, then try to import Data.SOP.NP.

Also create a Main.hs which imports Data.SOP.NP and try to compile with ghc.

Expected behavior

Neither ghci nor ghc should complain about not finding the module.

ghci should show a Loaded package environment from... message when starting up.

Environment

  • GHC version used: 8.10.3

  • Operating System: Windows 10

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