Cabal is an utility program that facilitates the creation of Haskell projects and the development of large Haskell programs.
When you install the entire Haskell platform with the command
sudo apt-get install haskell-platform
Cabal is installed together with the Haskell compiler some tools and the most important libraries.
If you did not install the entire Haskell platform, you can install Cabal separately with the command:
sudo apt-get install cabal-install
First start:
To download the package list you should update Cabal. You do it this way:
boris@boris-jetson:~/$ cabal update Downloading the latest package list from hackage.haskell.org
The download may take some time.
boris@boris-jetson:~/$ cabal --version cabal-install version 1.24.0.2 compiled using version 1.24.2.0 of the Cabal library
to create a simple project, it is sufficient to execute this command:
cabal init --non-interactive --is-executable --source-dir=src --license=GPL --main-is=Main.hs --package-name=CabalProject
mkdir CabalProject cd CabalProject cabal init
You are now asked some questions about your new project:
boris@boris-jetson:~/CabalProject$ cabal init Warning: The package list for 'hackage.haskell.org' does not exist. Run 'cabal update' to download it. Package name? [default: Example003-cabal] Package version? [default: 0.1.0.0] Please choose a license: 1) GPL-2 2) GPL-3 3) LGPL-2.1 4) LGPL-3 5) AGPL-3 6) BSD2 * 7) BSD3 8) MIT 9) ISC 10) MPL-2.0 11) Apache-2.0 12) PublicDomain 13) AllRightsReserved 14) Other (specify) Your choice? [default: BSD3] 1 Author name? Boris Gaertner Maintainer email? Boris.Gaertner@gmx.net Project homepage URL? Project synopsis? A simple test project Project category: * 1) (none) 2) Codec 3) Concurrency 4) Control 5) Data 6) Database 7) Development 8) Distribution 9) Game 10) Graphics 11) Language 12) Math 13) Network 14) Sound 15) System 16) Testing 17) Text 18) Web 19) Other (specify) Your choice? [default: (none)] 10 What does the package build: 1) Library 2) Executable Your choice? 2 What is the main module of the executable: * 1) Main.hs (does not yet exist, but will be created) 2) Main.lhs (does not yet exist, but will be created) 3) Other (specify) Your choice? [default: Main.hs (does not yet exist, but will be created)] Source directory: * 1) (none) 2) src 3) Other (specify) Your choice? [default: (none)] 2 What base language is the package written in: * 1) Haskell2010 2) Haskell98 3) Other (specify) Your choice? [default: Haskell2010] Add informative comments to each field in the cabal file (y/n)? [default: n] y Guessing dependencies... Generating LICENSE... Generating Setup.hs... Generating ChangeLog.md... Generating src/Main.hs... Generating Example003-cabal.cabal... You may want to edit the .cabal file and add a Description field.
It is possible to add some parameters to create a new project with a more complicated call of cabal
cabal init --help
You can immediately compile and run you programm:
cabal run :CabalProject
life cycle:
configure build run clean
ghc: setNumCapabilities: not supported on this platform sudo apt-get install libghc-base-compat-dev Das hilft nicht; die Meldung kommt noch immer.