What is a Cabal 'world' file for?
Asked Answered
C

1

8

What is the role of the ~/.cabal/world file, and what do its contents mean? I can't find any documentation and am confused by what I see there.

For example, it corresponds to nether the packages in my user database nor my global packages database, and while it seems to list only (a few of) the packages in my user database, it lists some that I've "removed" with ghc-pkg unregister.

Commercialism answered 4/10, 2015 at 14:1 Comment(0)
H
9

As far as I'm aware, it's automatically populated with any package you ever explicitly requested (thus including failed installs). This means that if you copy it to another machine, you can do

cabal install world 

to aim at replicating your current setup.

Of course, you can deregister a package behind cabal's back, and it won't know to delete it from your world file.

(Dependencies will be installed too, but I should emphasise that hackage will have moved on in the meanwhile, and that if you want reproducible installation, it's probably easier to use the stack tool, which has that as one of its principal design goals.)

Hebner answered 4/10, 2015 at 14:39 Comment(6)
That seems to be how it behaves.Commercialism
Great name, by the way.Hebner
It also apparently shows failed install attempts, which is odd.Commercialism
If ghc-pkg is deregistering "behind cabal's back", is there a way to do it in sight of Cabal?Commercialism
Indeed - anything you requested, rather than anything you installed. I've updated to make it clearer.Hebner
I know of no way to tell cabal install you don't want something any more. It's a dependency resolver and package installer, rather than a package manager as such.Hebner

© 2022 - 2024 — McMap. All rights reserved.