HaskellWiki

Haskell | Wiki community | Recent changes
Random page | Special pages

 

Not logged in
Log in | Help

Cabal/FAQ

< Cabal

Categories: FAQ

1 What is this hidden package?

You build a package and get a message like:

  Could not find module `Data.Map': it is a member of package
  containers-0.1.0.0, which is hidden.

This is because the package has not been updated for ghc-6.8 which has split the base package into lots of smaller packages. The package needs to be updated to say that it depends on these new split base packages, like containers, process and several others.

If you just want to get the package to build, add the missing package names to the build-depends: line in the .cabal file. For example given the above error message we would add the 'containers' package to the build-depends.

Developers of packages who want to know how to update their package properly so that it will continue to work with old and new compilers should see Upgrading_packages.

2 How do I handle Haskell language extensions?

If your code uses some of the advanced Haskell extensions, you have a number of options.

Each language extension has a standard name. You can find the list in Language.Haskell.Extension.

  1. The simplest way, if you're distributing via Cabal, is to add extensions: and the list of extensions names to your .cabal file. For example extensions: CPP, ForeignFunctionInterface. This allows every module in the package to use the listed extensions. Cabal will pass the appropriate flags to the compiler and it even checks that the compiler supports those extensions.
  2. The best way to do it, if you know your users are using GHC 6.8.x is the new LANGUAGE pragma. This allows you to enable just those extensions that you are using in a particular module. For example stick
    {-# LANGUAGE CPP, ForeignFunctionInterface #-}
    at the top of the file.
  3. An equivalent of the LANGUAGE pragma for older versions of GHC is the OPTIONS_GHC pragma (or for GHC 6.4 and older the OPTIONS pragma). The downside is that you have to know the GHC command line flag for the extensions you want. For example stick
    {-# OPTIONS_GHC -fffi -cpp #-}
    at the top of the file. Many other language extensions are enabled by -fglasgow-exts.

3 [Windows] I tried to install a Haskell binding to (some external C library), but I get build errors

Packages consisting of 100% Haskell code almost always build perfectly on Windows. However, packages which implement bindings to external C libraries (e.g., OpenSSH, libSDL, etc.) sometimes won't build on Windows without prodding.

  1. Check that the external C library is actually installed on your system. (Cabal does not do this for you.)
  2. Check the package contents, package home page, etc., to see if the author has told you how to get this package to work on Windows.

If those two fail to get you any further, proceed as follows:

Retrieved from "http://www.haskell.org/haskellwiki/Cabal/FAQ"

This page has been accessed 651 times. This page was last modified 21:51, 25 May 2008. Recent content is available under a simple permissive license.