Let Cabal-Install show the install plan - haskell

If I install a package using cabal install pkg then cabal will install all packages that pkg depends on. If there is a conflict with already installed packages then cabal shows which packages have to be installed freshly, which ones are updated and which installed ones will be broken.
Is there a way to get this list unconditionally instead of running the install procedure?

cabal install <pkg> --dry-run will print the packages that will be installed without actually performing any of the installation. It will not show this information though if the package is installed or similar.

Related

Cabal install hoogle not working

I need to configure eclipsefp and install hoogle and scion-browser for setting up a haskell project using mysql.
I tried to install hoogle and scion-browser from Eclipse -> Preference -> Helper executable, and also from the terminal, however unsuccessfully.
cabal install hoogle
and
cabal install scion-browser
fail, throwing the following:
cabal:codec.compression.zlib: premature end of compressed stream.
Edit:
It may be a problem with the cabal version?
If I run cabal --version in terminal, it says:
cabal-install version 0.14.0
using version 1.14.0 of the Cabal library
If I perform cabal update nothing happens.
However, in Eclipse -> Helper Executables there are two versions available:
version 0.14.0
version 1.18.0.2
They are located at different locations, I checked the second one to be used.
in my case, the downloaded package is broken, figured it out by running cabal install -v package-name, removed it manually and finally worked

I updated ghc to a new version, how do I automatically reinstall all cabal packages?

For instance, I've just updated ghc from 7.6.2 to 7.6.3 and would like just reinstall all the packages I had previously installed.
Running
cabal install world
will install all the previously installed packages. Some packages might not install, in which case one can delete them from ~/.cabal/world and run the command again, and install them again later when they are working again with that version of ghc.

Trouble installing Timeplot in RHEL

When installing Timeplot in RHEL 6 using the following command
cabal install timeplot
I get the following error:
Data/Array/IArray.hs:1:14: Unsupported extension: Trustworthy
To install timeplot I needed to install the haskell-platform and cairo-devel package (from EPEL) with
sudo yum install haskell-platform cairo-devel
Then install gtk2hs-buildtools
cabal install gtk2hs-buildtools
Open a new terminal at this point to get the new $PATH that includes $HOME/.cabal/bin
You many need to manually install strptime-1.0.6, as strptime-1.0.7 gave me the following error
building strptime-1.0.7...
Data/Time/Parse.hsc:22:18:
Could not find module `Foreign.ForeignPtr.Unsafe':
Use -v to see a list of the files searched for.
Install strptime-1.0.6 with
cabal install strptime-1.0.6
Then install timeplot
cabal install timeplot
Timeplot probably depends on a newer array than what comes with the installed GHC or platform, and thus it tries to pull it off hackage. And the new array (that is selected by default) is not backwards compatible with older GHCs.

How do you install packages/libraries without Cabal or Cabal-Install?

I'm trying to set up Haskell from scratch, on Ubuntu 11.04, without using the outdated Debian repository or Haskell-Platform.
I've installed GHC-7.0.4 from source with no problem, and now need to install Cabal (which appears to already be included in GHC in /usr/local/lib/ghc-7.0.4/Cabal-1.10.2.0) and Cabal Install.
The latter specifies several dependencies (parsec and network), each of which has several dependencies of their own (mtl, text, etc).
What's the command to install these packages, that I downloaded from hackage in tar.gz form?
Unpack, then runhaskell doesn't work.
I see Setup.lhs, but it's not clear what that's for or how to use it.
Most of the Haskell documentation I've found assumes you've installed from a repo or Haskell-Package and doesn't really explain this well.
cabal-install has a shell script that does this. If you download it from hackage and install it, you can start bootstrap.sh to install cabal-install. You can then use it to install other packages.
There are two different packages: Cabal and cabal-install. Cabal is a library, and cabal-install is an executable named cabal.
To install a package, cabal-install is an optional convenience wrapper around Cabal, but Cabal is required.
According to http://hackage.haskell.org/trac/ghc/wiki/Commentary/Libraries , Cabal is a 'zero-boot' package, so when you build GHC, Cabal and its dependencies are built for you automatically.
You can use ghc-pkg executable to check which packages are already installed:
# ghc-pkg list
Check if Cabal is in the list after you build GHC. If yes, you can install more packages without cabal-install using this documentation:
http://haskell.org/haskellwiki/Cabal/How_to_install_a_Cabal_package
I suggest you to install cabal-install first, and then install everything else using cabal-install executable. A usual commandine for global installation is this:
# runhaskell Setup configure
# runhaskell Setup build
# sudo runhaskell Setup install
Unpack a package tarball and run the commands in the folder with Setup.hs or Setup.lhs files. Note that a per-user non-root installation is also supported - Use runhaskell Setup configure --user
When you install cabal executable and its dependencies this way, use cabal install {package-name} to install more packages.
Note that Haskell Platform exists mostly because of the pain of installing cabal-install by yourself.

Haskell Cabal regenerate documentation for all installed packages

How can I generate and install documentation for all locally installed cabal packages? I turned on the documentation flag in ~/.cabal/config which means that all newly installed packages will have documentation also generated. But how to generate documentation for all already installed packages?
Is there a way to automatically cabal install --reinstall all already installed packages? And more importantly, is that a good idea?
If you have a recent-ish version of cabal-install (>= 0.10, I think), you can try doing
$ cabal install --reinstall --upgrade-dependencies world
Unfortunately, it didn't work in my case:
$ cabal install --dry-run --reinstall world
Resolving dependencies...
cabal: cannot configure Agda-2.2.10. It requires haskell-src-exts >=1.9.6 &&
<1.10
For the dependency on haskell-src-exts >=1.9.6 && <1.10 there are these
packages: haskell-src-exts-1.9.6. However none of them are available.
haskell-src-exts-1.9.6 was excluded because haskell-src-exts-1.11.1 was
selected instead
haskell-src-exts-1.9.6 was excluded because hlint-1.8.12 requires
haskell-src-exts ==1.11.*
If you bump into an error like this, you can try manually editing the ~/.cabal/world file.
Please note that cabal install --only-dep --reinstall does not work.
If you are using a sandbox, you can do
cabal sandbox delete
cabal sandbox init
cabal install -j --only-dep --enable-documentation
The -j option allows it to build in parallel.
You could try something like this in bash.
for pkg in `ghc-pkg list --simple`
do
cabal install $pkg --reinstall
done
But I really don't know, whether it's a good idea.

Resources