commercialhaskell / commercialhaskell/stack

Stack doesn't list optionally-compiled module in the targets

Open
#5,480 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Haskell
Stars
4.1k
Forks
850
Avg merge
10h 37m
Merged PRs (30d)
4

Description

### General summary/comments (optional)
As @fendor pointed out in haskell/haskell-language-server#1270, it seems stack doesn't list modules which are turned off by default, but enabled by the flags configured in `stack.yaml`.

### Steps to reproduce

1. `git clone https://github.com/konn/hls-conditional-modules.git`
2. Run command `stack ghci`.

#### Include any `.yaml` configuration if relevant.
Included in the above repro repo, but the essential part is the following:

```yaml
flags:
hls-conditional-modules:
disable-lib2: false
```

### Expected

GHCi should load all four modules including `Lib2.hs` and `Lib2/Internal.hs`

### Actual

3. `Lib.hs` and `Lib/Internal.hs` are imported, but `Lib2.hs` and `Lib2/Internal.hs` aren't loaded which must be conditionally built.

This behaviour prevents HLS from loading necessary modules when some modules are off by default, as described in haskell/haskell-language-server#1270.

On the other hand, `stack build` builds all the needed modules based on the flags.

If you suspect that a stack command misbehaved, please include the output of that command in `--verbose` mode.
If the output is larger than a page please paste the output in a [Gist](https://gist.github.com/).

```$ stack ghci --verbose```

Gist: https://gist.github.com/konn/dd708b4623ef5f0ae8cf56905a7dedd5#file-stack-verbose-log

### Stack version

```
$ stack --version
Version 2.5.1, Git revision d6ab861544918185236cf826cb2028abb266d6d5 x86_64 hpack-0.33.0
```

### Method of installation

* Official binary, downloaded from stackage.org or fpcomplete's package repository and then upgraded by itself.

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.