[Haskell-cafe] Cabal install fails, don't understand why
Volker Wysk
post at volker-wysk.de
Sat Mar 30 17:22:15 UTC 2024
Am Freitag, dem 29.03.2024 um 13:48 -0400 schrieb Brandon Allbery:
>
>
> On Fri, Mar 29, 2024 at 1:15 PM Volker Wysk <post at volker-wysk.de> wrote:
> > > The proper way to work with libraries outside of a project is "cabal
> > > repl"
> > > or "stack ghci" as appropriate. For quick one-offs with cabal, you can
> > > use
> > > e.g. `cabal repl -b HsShellScript`. (I don't know the stack
> > > equivalent,
> > > sorry.)
> >
> > What do you mean by "libraries outside of a project"? The library is one
> > project by itself. I don't (?) have any libraries outside of projects
> > (that
> > I know of).
> >
>
>
> 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.
> The biggest problem with both stack's global configuration and cabal's use
> of environment files is the need for manual management when new versions
> of packages are released: neither tool currently gives you any way to
> manage either, and having multiple versions of a package in either invites
> trouble. I can't speak for stack, but cabal devs are aware of the problem
> and considering how best to deal with it (see for
> example https://github.com/haskell/cabal/issues/9581).
You mean when you have code outside of projects, I guess. Multiple versions
should be easily managed by cabal (or stack, which I don't know).
I'm willing to subject myself to the way to do it, which is predefined by
cabal (or stack), when in return, it all works without much hassle. I want
to write code, not fight with the package management system.
Happy hacking,
Volker
More information about the Haskell-Cafe
mailing list