
On Sat, 30 Mar 2024, Volker Wysk wrote:
Am Freitag, dem 29.03.2024 um 13:48 -0400 schrieb Brandon Allbery:
Cabal and stack are designed around the notion of projects, defined by a cabal file (or `package.yaml` if you use Hpack), `stack.yaml` for stack, optional `cabal.project` for cabal. Projects are sandboxed such that the package(s) in the project use consistent versions of all dependencies.
Neither tool handles use outside of a project well, although stack has a global configuration (whose use for this is deprecated iirc) and cabal uses ghc's environment files when requested. So something that isn't really intended for use as part of a project isn't well handled by either one.
Sounds complicated. I guess the best way to avoid trouble, is to do everything in projects and avoid code outside of projects.
You can easily turn code outside of a project into code inside a project, by adding something to the 'packages' field in cabal.project or add a separate 'source-repository-package' entry in the cabal.project. Or you stick to 'cabal v1-install'.