diff options
Diffstat (limited to 'haskell/cabal-lib.md')
-rw-r--r-- | haskell/cabal-lib.md | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/haskell/cabal-lib.md b/haskell/cabal-lib.md index 2504fc8..3688d05 100644 --- a/haskell/cabal-lib.md +++ b/haskell/cabal-lib.md @@ -131,12 +131,12 @@ active package flags: and you can even make that change permanent with `cabal install --lib base`, which adds (in my case) a line `package-id base-4.17.2.0` to the aforementioned `default` file. -In short, a _GHC environment file_ was created by `cabal` that contains a list of packages in scope for `ghc` when you're accessing `GHC` through `cabal` in the context of a project. +In short, a _GHC environment file_ was created by `cabal` that contains a list of packages in scope for `ghc` when you're not using `cabal`, or outside the context of a project. You need to either manage this file manually or through some [helper tool](https://github.com/phadej/cabal-extras), and you will need to, because `cabal` won't resolve conflicts for you. You're back to manual, imperative management of dependencies. -Furthermore, this way of installing dependencies is fundamentally separate from the code that _uses_ those dependencies, and is just one such list. -So if you have multiple scripts that you'd like to work globally, outside of a project, their dependency sets had better be compatible. +Furthermore, this way of installing dependencies is fundamentally separate from the code that _uses_ those dependencies, and there is just _one_ such global list. +So if you have multiple Haskell programs that you'd like to work globally, outside of a project, their dependency sets had better be compatible, or things will break. ## How to fix the situation @@ -151,7 +151,7 @@ Removing the entire store folder for a particular GHC version is safe, however - ## What to do instead Create a project! -The intended mode of operation of the modern Haskell tooling, that is `cabal` and `stack`, is to always work inside of a _project_. +The intended mode of operation of the modern Haskell tooling, that is `cabal` or `stack`, is to always work inside of a _project_. Often, "project" basically means "package", but you can have projects with multiple packages in them (using a `cabal.project` file, see [the docs](https://cabal.readthedocs.io/en/3.10/cabal-project.html)). Creating a package is easily done using `cabal init --simple` inside a fresh directory. @@ -164,8 +164,8 @@ A package (a single thing in the package repository, should you decide to upload (There is also the concept of an "internal library", for which see [the documentation](https://cabal.readthedocs.io/en/3.10/cabal-package.html#sublibs), but don't worry about that.) You can start writing code in the `app/Main.hs` file (or `src/MyLib.hs` file if you selected Library) and run using `cabal run` (or build using `cabal build` in the case of a library). -`cabal` will automatically ensure that a consistent set of versions is compiled and made available, if at all possible. -You can add [version bounds](https://cabal.readthedocs.io/en/3.10/cabal-package.html#pkg-field-build-depends) to your dependencies if you want to apply some proper software engineering principles. +**`cabal` will automatically ensure that a consistent set of versions is compiled and made available, if at all possible.** +You can also add [version bounds](https://cabal.readthedocs.io/en/3.10/cabal-package.html#pkg-field-build-depends) to your dependencies if you want to apply some proper software engineering principles. (If you want to use `stack` instead of `cabal`, try [their getting started guide](https://docs.haskellstack.org/en/stable/GUIDE/).) |