Questions tagged [cabal]

Cabal is a package distribution and build system for the Haskell programming language.

Cabal stands for Common Architecture for Building Applications and Libraries. It is a package distribution and build system for the Haskell programming language. It is integrated with Hackage, a central package archive of open-source software written in Haskell. Cabal can refer both to the Cabal library which Setup.hs files can link against in order to build Haskell packages, and the command-line tool, which provides a range of additional functionality, including automatically fetching packages from , solving dependency graphs of version constraints to obtain install plans, managing sandboxed package environments, and much more.

More information about Cabal can be found at the Cabal website.

1793 questions
39
votes
1 answer

How can I use GHCi with the new cabal 1.17 sandboxes?

I've been trying out cabal head which has support for sandboxes similar to cabal-dev. However there's not yet support for a cabal-dev ghci equivalent and apparently no support planned for the next release. Is there some incantation I can use to…
jberryman
  • 16,334
  • 5
  • 42
  • 83
37
votes
2 answers

What's the best workaround for not having "cabal upgrade"?

I want to upgrade all packages, not just a specific one with cabal install --upgrade-dependencies.
gatoatigrado
  • 16,580
  • 18
  • 81
  • 143
37
votes
1 answer

How to get cabal and nix work together

As far as I understood, Nix is alternative for cabal sandbox. I finally managed to install Nix, but I still don't understand how it can replace a sandbox. I understand you don't need cabal using Nix and the wrapped version of GHC; however if you…
mb14
  • 22,276
  • 7
  • 60
  • 102
36
votes
6 answers

Is there any way to define flags for cabal dependencies?

I recently ran into a Cabal issue that I only managed to solve by manually installing transformers-compat with the -f transformers3 flag in my cabal sandbox before running cabal install for my project. Is there any way to indicate in my…
shang
  • 24,642
  • 3
  • 58
  • 86
35
votes
2 answers

Building with runtime flags using cabal and ghc

I have a program written in Haskell and intended to be compiled with GHC. The program scales very well on multiple cores, so enabling multithreading is very important. In my .cabal file I've added ghc-options: -O3 -threaded to link with the threaded…
Viktor Dahl
  • 1,942
  • 3
  • 25
  • 36
35
votes
4 answers

Haskell Stack install package dependency from github

Is it possible to install a version of a package from github using Haskell stack? e.g. in a .cabal or a stack.yaml file, how can I point a dependency at a git repo/branch/revision?
Abraham P
  • 15,029
  • 13
  • 58
  • 126
35
votes
2 answers

Generating documentation for my own code with Haddock and stack

I have annotated my code in Haddock style and would like to generate browse-able documentation. Since I am also using stack, I want to integrate the documentation generation into the workflow. However, I have not yet been able to generate anything…
Sam van Herwaarden
  • 2,321
  • 14
  • 27
34
votes
2 answers

What is the relationship between ghc-pkg and cabal?

With respect to how packages are created, installed and used in Haskell, what is the relationship between ghc-pkg and cabal? What are their roles - when would you use one, over the other, or use both? Are they complementary tools, competitive tools,…
Ben Lever
  • 2,023
  • 7
  • 26
  • 34
33
votes
3 answers

How do I get ghci to see packages I installed from cabal?

I've installed the such-and-such a package using cabal, and I can build a program that depends on it using cabal build. But when I load the same program in ghci, ghci complains that it "Could not find module `such-and-such'". I'm surprised this…
Dominic Cooney
  • 6,317
  • 1
  • 26
  • 38
32
votes
1 answer

How to list all the installed packages and their version with Cabal?

Is there a simple command / option that lets you do that? I could use grep but I wonder if there is a builtin option?
frmsaul
  • 1,366
  • 2
  • 12
  • 19
31
votes
9 answers

Have I upgraded my cabal-install?

I just installed Haskell from it's official site. After that, following it's quick-start tutorial. I run: cabal update Which shows this message: Downloading the latest package list from hackage.haskell.org Note: there is a new version of…
Luis Ortega Araneda
  • 865
  • 1
  • 12
  • 26
30
votes
4 answers

Is there a simple way to load extra packages to ghci when invoked via cabal repl?

cabal repl is quite useful for debugging a library, however ghci will have all packages hidden that aren't dependencies of the cabal package. While that is certainly a good thing for cabal build, for repl it means I can't load something from an…
leftaroundabout
  • 117,950
  • 5
  • 174
  • 319
29
votes
3 answers

Full definition of .cabal file syntax

I have googled extensively, and while I can find many examples of cabal files as well as good tutorials, I would like to have a proper grammar definition for the .cabal file format. Alas, I have not been able to find it. The more recent cabal…
Jacques Carette
  • 3,052
  • 1
  • 22
  • 28
27
votes
2 answers

Eliminating repetition in cabal files

I often have similar properties in many stanzas of my .cabal files. E.g. Library x ... ghc-options: -O2 -Wall -fno-warn-missing-signatures -fwarn-incomplete-patterns -fno-warn-name-shadowing Executable y ... …
daf
  • 5,085
  • 4
  • 31
  • 34
26
votes
1 answer

Haddock, Cabal: How to include source code examples?

I am the author of the operational package, which includes example code. I would like this example code to be hscolored and installed together with the API documentation, which is generated by Haddock. I probably have to use a custom Cabal build…
Heinrich Apfelmus
  • 11,034
  • 1
  • 39
  • 67