Re: Cabal install fails, don't understand why

Brandon Allbery <[email protected]>
Newsgroups gmane.comp.lang.haskell.cafe
Message-ID <CAKFCL4VwtD5axhZE0NtTaApgmttj=RMrSiQYBtKHctHvjozCzQ@mail.gmail.com>
On Fri, Mar 29, 2024 at 1:15 PM Volker Wysk <[email protected]> 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.

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).

-- 
brandon s allbery kf8nh
[email protected]

_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.