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