Cabal
Working with sandboxes
Section titled “Working with sandboxes”A Haskell project can either use the system wide packages or use a sandbox. A sandbox is an isolated package database and can prevent dependency conflicts, e. g. if multiple Haskell projects use different versions of a package.
To initialize a sandbox for a Haskell package go to its directory and run:
cabal sandbox initNow packages can be installed by simply running cabal install.
Listing packages in a sandbox:
cabal sandbox hc-pkg listDeleting a sandbox:
cabal sandbox deleteAdd local dependency:
cabal sandbox add-source /path/to/dependencyInstall packages
Section titled “Install packages”To install a new package, e.g. aeson:
cabal install aesonSyntax
Section titled “Syntax”- cabal
where is one of:
- update
-
- Updates list of known packages
-
Install packages
-
Help about commands
-
Display detailed information about a particular package
-
List packages matching a search string
-
Downloads packages for later installation
-
Display and update the user’s global cabal configuration
- get
-
- Download/Extract a package's source code (repository)
-
Create a new .cabal package file (interactively)
-
Prepare to build the package
-
Compile all/specific components
-
Clean up after a build
-
Builds and runs an executable
-
Open an interpreter session for the given component
-
Run all/specific tests in the test suite
-
Run all/specific benchmarks
-
Check the package for common mistakes
-
Generate a source distribution file (.tar.gz)
-
Uploads source packages or documentation to Hackage
-
Upload build reports to a remote server
-
Freeze dependencies
-
Generate dependency bounds
-
Generate Haddock HTML documentation
-
Generate HsColour colourised code, in HTML format
-
Copy the files into the install locations
-
Register this package with the compiler
- sandbox
- Create/modify/delete a sandbox
-
- cabal sandbox init [FLAGS]
- cabal sandbox delete [FLAGS]
- cabal sandbox add-source [FLAGS] PATHS
- cabal sandbox delete-source [FLAGS] PATHS
- cabal sandbox list-sources [FLAGS]
- cabal sandbox hc-pkg [FLAGS] [--] COMMAND [--] [ARGS]
-
Give a command access to the sandbox package repository
-
Open interpreter with access to sandbox packages
-
- Create/modify/delete a sandbox
-
-