haskell-packages: Haskell suite library for package management and integration with Cabal

[ distribution, library, mit ] [ Propose Tags ]

See http://documentup.com/haskell-suite/haskell-packages

[Skip to Readme]
Versions [RSS] [faq] 0.1, 0.2, 0.2.1, 0.2.2, 0.2.3,,,,, 0.2.4,,,,, 0.3, 0.4, 0.5, 0.6, 0.6.1, 0.6.2
Change log CHANGELOG.md
Dependencies aeson (==0.6.*), base (>=4.5 && <5), bytestring (>=0.9), Cabal (>=1.14 && <1.21), containers, deepseq, directory, EitherT, filepath, haskell-src-exts (>=1.14), hse-cpp, mtl (>=2.1), optparse-applicative (>=0.6 && <0.10), tagged [details]
License MIT
Copyright (c) Roman Cheplyaka 2012
Author Roman Cheplyaka
Maintainer Roman Cheplyaka <roma@ro-che.info>
Revised Revision 2 made by AdamBergmark at 2015-05-19T12:39:13Z
Category Distribution
Home page http://documentup.com/haskell-suite/haskell-packages
Bug tracker https://github.com/haskell-suite/haskell-packages/issues
Source repo head: git clone git://github.com/haskell-suite/haskell-packages.git
this: git clone git://github.com/haskell-suite/haskell-packages.git(tag v0.2.3.1)
Uploaded by RomanCheplyaka at 2013-10-13T16:47:24Z
Distributions NixOS:0.6.2
Downloads 21217 total (101 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs available [build log]
Successful builds reported [all 1 reports]




Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.

Maintainer's Corner

For package maintainers and hackage trustees


Readme for haskell-packages-

[back to package description]

There are two cases when you may need haskell-packages: if you are writing a Haskell compiler (or any tool that processes Haskell source code, such as a static analyzer), or if you want to integrate with an existing Haskell compiler that uses haskell-packages.

Writing a compiler

If you are writing a compiler, you typically want to integrate it with Cabal, to be able to build ordinary Haskell packages.

If you go the hard way, this involves:

  1. Parsing command line parameters. Sounds easy — just take a list of files to compile. In reality you also need to handle package ids and package dbs, CPP options (-DFOO=1), language extension flags (-XRankNTypes) etc.

    To integrate with Cabal, you also need to tell it the list of installed packages, supported languages and extensions etc.

  2. Actual integration with Cabal means understanding how Cabal works and hard-coding support for your compiler. And then getting it accepted and waiting for the next Cabal release.

    You may pretend that you are GHC or other compiler that is already supported by Cabal. It might work, but often it won't, for various reasons. Also, GHC's command line protocol is quite complex.

  3. Package management. You need to implement a package db mechanism, which would let you to keep track of installed packages. Then you'd have to implement a ghc-pkg-like tool to manage those databases, for both Cabal and your users.

Or, you can simply use this library!

It already has command line options parsing, Cabal support, and package management. All you need to do is to provide the function to do actual compilation and tell a couple of other things about your compiler. See the Distribution.HaskellSuite.Compiler module for details.

Using other compilers

Some compilers produce artifacts that you may want to use. A good example is the hs-gen-iface compiler from haskell-names which generates an interface for each module — the set of all named entities (functions, types, classes) that are exported by that module. This information can be then used either by other compilers, or by tools like IDEs.

Assuming the compiler uses haskell-packages and exports its database type, it's very easy to use its artifacts. See Distribution.HaskellSuite.Packages for package resolution and Distribution.HaskellSuite.Modules for module resolution.


It doesn't matter what Cabal version you use together with haskell-packages, but if you want to invoke a haskell-packages compiler from Cabal (see Usage), you need to build our fork of Cabal. Eventually it will be merged into Cabal.


To compile a Haskell package using a haskell-packages tool:

cabal install --haskell-suite -w $TOOL

where $TOOL may be either a full path to the compiler, or just an executable name if it's in $PATH.