[Haskell-cafe] putting SOE 'on the library path'

Daniel Fischer daniel.is.fischer at web.de
Sat Mar 28 14:15:33 EDT 2009

Am Samstag 28 März 2009 18:46:39 schrieb Michael Mossey:
> I tried the -v, but I seem to have fixed my problem. It's working now. I
> don't know what I changed. Maybe I typed the paths wrong before. 
> it does seem to accept (on Windows) paths with backslashes and it
> accepts spaces in the path if you put quotes around it.
> I'm still interested, though, in how one "installs" packages or 
> so they don't need to be on the path specified by -i. I notice there is
> a file called 'package.conf', which seems related to this.

Use Cabal.

a) module A.B.C should be in file A/B/C.hs, where A is a direct 
subdirectory of the top of your source-tree.

b) above your source tree, place the file packagename.cabal, where 
you tell Cabal the name of the package, its version number, licence, 
build depends, exposed modules and other stuff (read 
and http://www.haskell.org/ghc/docs/latest/html/Cabal/authors.html for 
details) and a Setup.hs, which can often consist of the two lines

import Distribution.Simple
main = defaultMain

If you want to install a package written by somebody else, that should 
already be present in the bundle you got.


runghc ./Setup.(l)hs configure

with the appropriate options, whether to allow dependencies to be 
satisfied from the user package database, whether to install per user 
or globally, install prefix, whether to build the library also for profiling, 

runghc ./Setup.hs build


runghc ./Setup.hs haddock

runghc ./Setup.hs install

That registers the package in the package database, and from then 
on, it will be automatically found by ghc --make.

If you have the cabal executable, it's even easier, just

cabal install packagename

if it's somebody else's package, that automatically takes care of its 
(Haskell) dependencies, downloads and installs them if necessary;

or simply

cabal install

in the appropriate directory if it's a package you have just written.

More information about the Haskell-Cafe mailing list