haskell / haskell/cabal

`-hide-package` and .ghc.environment files

Open
#6,390 1 comment 0 reactions 0 assignees View on GitHub
blocked: info-needed type: user-question
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

**Describe the bug**

I can't figure out how to `-hide-package` in the presence of `.ghc.environment` files, which renders my application unusable unless I manually edit the automatically-generated environment file each time

**To Reproduce**
Steps to reproduce the behavior:

1. Clone https://github.com/gibiansky/IHaskell/
1. Checkout `a442c0b6d4cf1fb17eaa3bf2827f04b21ad334bf` (current master as of this writing)
1. Change the `cabal.project` file to avoid building any `ihaskell-display` packages:
```
packages: .
./ipython-kernel
./ghc-parser
```
1. Install Jupyter and system dependencies
1. `cabal v2-run -- ihaskell install`
1. `cabal v2-exec -- jupyter notebook` and launch a notebook with the Haskell kernel
1. Observe an error like this one: `ihaskell: Ambiguous module name ‘Language.Haskell.TH’: it was found in multiple packages: ghc-lib-parser-8.8.0.20190723 template-haskell-2.14.0.0`
1. `cabal v1-run -- ihaskell install`
1. `cabal v1-exec -- jupyter notebook` and launch a notebook with the Haskell kernel
1. No error is observed.

Additionally, if I edit the environment file that is being used and remove the line referring to `ghc-lib-parser` then the kernel restarts and then works without any errors.

**Expected behavior**

I'm hiding `ghc-lib-parser` to avoid precisely the error above, so my expectation is that Cabal will respect the `-hide-package ghc-lib-parser` flag I am passing to GHC.

**System information**
- NixOS 19.09
- `cabal-install 3.0.0.0`
- `GHC 8.6.5`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.