haskell / haskell/cabal

Ambiguity between package target and component target should resolve in favour of the package

Open
#9,009 3 comments 0 reactions 0 assignees View on GitHub
re: target re: user experience type: enhancement
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

**Describe the bug**
`haskell-language-server` has a cabal package of that name, which contains an executable of the same name.

That means that the `haskell-language-server` target is ambiguous between:
1. The package target
2. The component target for `lib:haskell-language-server`
3. The component target for `exe:haskell-language-server`

As a result, cabal says:
```
Error: cabal: Ambiguous target 'haskell-language-server'. It could be:
exe:haskell-language-server (component)
lib:haskell-language-server (component)
```

Somehow this doesn't bite if the executable isn't present, even though there is still an ambiguity between 1 and 2.

**To Reproduce**

Check out https://github.com/haskell/haskell-language-server and run `cabal build haskell-language-server`.

**Expected behavior**

I think the package target should always win if it is ambiguous with a component target. You can always disambiguate in favour of the component target, but there is no other way to select the package target (and hence to build all components in the package).

**System information**
- `cabal-3.10`

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.