[Haskell-cafe] Cabal install fails, don't understand why

Brandon Allbery allbery.b at gmail.com
Fri Mar 29 17:48:14 UTC 2024


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.

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
allbery.b at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20240329/9f939e06/attachment.html>


More information about the Haskell-Cafe mailing list