Skip to content

-hide-package doesn't play nice with -package-env

Summary

When I use -hide-package in combination with -package-env then it seems to have no effect.

Steps to reproduce

With cabal-install-3.10.2.1:

$ tree
.
├── foo.cabal
└── src
    └── Prelude.hs
cabal-version: 3.8
name: foo
version: 0.0.0

library
  build-depends: base
  mixins: base (Prelude as BasePrelude)
  hs-source-dirs: src
  exposed-modules: Prelude
{-# LANGUAGE NoImplicitPrelude #-}
module Prelude where
import BasePrelude
foo :: Int
foo = 23
$ cabal install --package-env=package.env --lib
$ ghci -package-env=package.env -hide-package=base
ghci> import Prelude

<no location info>: error: [GHC-45102]
    Ambiguous module name ‘Prelude’.
    it was found in multiple packages: base-4.19.0.0 foo-0.0.0

Expected behavior

The module Prelude from package foo is used.

Environment

  • GHC version used: 9.8.1
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information