[Haskell-beginners] How to structure your Haskell installation?

Daniel Fischer daniel.is.fischer at googlemail.com
Tue Mar 22 14:05:57 CET 2011


On Tuesday 22 March 2011 13:31:44, frode k wrote:
> Hi.
> 
> I'm installing the Haskell Platform om my Linux box and need some tips
> on how to structure the files on the OS. I need to install and use both
> GHC 6.12.3 and GHC 7.0.2. Hence I want to separate these installations.
> I've setup two directories, one for each platform (related to the GHC):
> 
> # ls -d -1 $PWD/*.*
> /usr/haskell/2010.2.0.0
> /usr/haskell/2011.2.0.0
> 
> I've installed GHC-6.12.3 in "2010.2.0.0" and will install GHC-7.0.2 in
> "2011.2.0.0".
> 
> My question is more related to where I should install the packages. When
> I install a package using "runhaskell Setup ..." I assumed this to ONLY
> be installed for the version of GHC I'm using when installing it. Am I
> right about this?

Yes. A package can only be installed for the compiler it was compiled with, 
so to install it for multiple compilers you have to compile it repeatedly.

> 
> Having $PATH pointing to GHC-6.12.3 I've done this when installing
> packages, to add them to "2010.2.0.0":
> - - - - - - -
> cd /usr/src
> wget
> http://hackage.haskell.org/packages/archive/transformers/0.2.2.0/transfo
> rmers-0.2.2.0.tar.gz tar xzf transformers-0.2.2.0.tar.gz
> cd transformers-0.2.2.0
> runhaskell Setup configure --prefix=/usr/haskell/2010.2.0.0/
> runhaskell Setup build
> runhaskell Setup install
> - - - - - - -

Install cabal-install, then

$ cabal install --with-compiler=/path/to/desired/ghc wanted-package

takes care of it automatically (after tweaking the settings in cabal's 
config file). And it gets necessary Haskell dependencies automatically and 
installs them, too.

> 
> Later when I switch to GHC-7.0.2 I plan to install the packages into the
> "2011.2.0.0" directory in stead.
> 
> Is this a good way to structure several Haskell installations on the
> same system? Is there a "best practice" on how to structure the files?

Don't know. I have everything under $HOME and let GHC and cabal figure out 
how to organise packages. Works for me™.

> I want to get this right from the start, to avoid having to go back and
> re-arrange everything.
> 
> Regards,
> Frode K
> 
> [k]



More information about the Beginners mailing list