haskell / haskell/cabal

Reinstall of package breaks things

Open
#6,391 22 comments 5 reactions 0 assignees View on GitHub
cabal-install: cmd/install re: install --lib type: bug
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

If I change then install a package I'm developing, ghci can no longer use it, it seems because there are two installations with the same version number. Transcript below. This is with the a fresh install via ghcup under linux.

Also, I don't know why I now have to specify `--lib` when presumably the module knows it's a library. As a general comment, documentation for `v2-install` doesn't seem up to date and I can't find clear explanations of the changes and how they can help my project

```console
alex@stanage:~/tmp$ git clone https://github.com/tidalcycles/tidal.git
Cloning into 'tidal'...
remote: Enumerating objects: 125, done.
remote: Counting objects: 100% (125/125), done.
remote: Compressing objects: 100% (76/76), done.
remote: Total 9909 (delta 47), reused 93 (delta 32), pack-reused 9784
Receiving objects: 100% (9909/9909), 6.65 MiB | 1.54 MiB/s, done.
Resolving deltas: 100% (5383/5383), done.
alex@stanage:~/tmp$ cd tidal
alex@stanage:~/tmp/tidal$ cabal install --lib
Wrote tarball sdist to
/home/alex/tmp/tidal/dist-newstyle/sdist/tidal-1.4.6.tar.gz
Wrote tarball sdist to
/home/alex/tmp/tidal/dist-newstyle/sdist/tidal-parse-0.0.1.tar.gz
Resolving dependencies...
Up to date
alex@stanage:~/tmp/tidal$ echo "" >> src/Sound/Tidal/Pattern.hs
alex@stanage:~/tmp/tidal$ cabal install --lib
Wrote tarball sdist to
/home/alex/tmp/tidal/dist-newstyle/sdist/tidal-1.4.6.tar.gz
Wrote tarball sdist to
/home/alex/tmp/tidal/dist-newstyle/sdist/tidal-parse-0.0.1.tar.gz
Resolving dependencies...
Build profile: -w ghc-8.6.5 -O1
In order, the following will be built (use -v for more details):
- tidal-1.4.6 (lib) (requires build)
Starting tidal-1.4.6 (lib)
Building tidal-1.4.6 (lib)
Installing tidal-1.4.6 (lib)
Completed tidal-1.4.6 (lib)
alex@stanage:~/tmp/tidal$ ghci
GHCi, version 8.6.5: http://www.haskell.org/ghc/ :? for help
Loaded package environment from /home/alex/.ghc/x86_64-linux-8.6.5/environments/default
Prelude> import Sound.Tidal.Context

: error:
Ambiguous module name ‘Sound.Tidal.Context’:
it was found in multiple packages: tidal-1.4.6 tidal-1.4.6
Prelude>
Leaving GHCi.
alex@stanage:~/tmp/tidal$ grep tidal ~/.ghc/x86_64-linux-8.6.5/environments/default
package-id tidal-1.4.6-29102d7626eceae1acf25d4320134825bb64112fb11058d394e0d55078882cde
package-id tidal-1.4.6-53f34a7fc0ce460f98fce9b704f6ab422c96435b533e18602b8728ba5e16553e
```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the transcript with cabal install --lib, editing the package, reinstalling it, and then importing it in ghci. Inspect the generated package environment at ~/.ghc/x86_64-linux-8.6.5/environments/default; done means reinstalling does not leave duplicate package IDs, and the v2-install/--lib behavior is clearly documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
cli, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.