cabal icon indicating copy to clipboard operation
cabal copied to clipboard

Command to 'reset' cabal

Open yaxu opened this issue 3 years ago • 3 comments

Cabal has problems with working with libraries (e.g. https://github.com/haskell/cabal/issues/8337), where workarounds are to locate and delete files in hidden folders. These bugs have been around for years and aren't likely to be solved soon.

Would it be possible to have a command that 'reset' cabal to a clean state? E.g. cabal reset for deleting the environment file, perhaps with a modifier for deleting the whole package database?

yaxu avatar Aug 03 '22 20:08 yaxu

Where is the environment file located in your use cases? IIRC in something like ~/.ghc/foo? My main question is whether it's central location, because if it's in the working directory, cabal clean should probably do that. OTOH, if you do cabal install foo from Hackage, you don't have a working directory?

Mikolaj avatar Aug 03 '22 20:08 Mikolaj

I also wonder what other commands we have that change global files. I think there's something like cabal config and perhaps there is a flag for that to remove or reset the ~/.cabal/config file. If that's true, we have a precedent and we can try to unify how it's done.

Mikolaj avatar Aug 03 '22 20:08 Mikolaj

because if it's in the working directory, cabal clean should probably do that

Yes and no... it'd be nice but cabal can't yet know if a local environment file was generated by itself and thus safe to delete as part of clean. And what about environments generated through write-ghc-environment-files vs install --lib? A separate command would be best.

This should really be done properly as part of cabal env. Maybe we could proactively put such a command under a new env namespace (cabal env reset or cabal env delete --all) and make it just delete the global environments?

fgaz avatar Aug 03 '22 21:08 fgaz