putting SOE 'on the library path'

This is a beginners question, which I have posted to beginners@haskell.org several times, but because I have gotten no answer, I thought I would try the cafe. I'm working through the "School of Expression" book, and I would like to install the code that comes with the book somewhere. Right now I have to write my exercise programs in the same directory where the SOE code is sitting so that my exercise programs can import SOE modules. My platform is Windows. I tried using the -i options to ghc and ghci, but to no avail. It wasn't clear on Windows in what form -i takes its arguments: backslashes as usual for Windows, forward slashes perhaps? How about paths with spaces in them? Does it need quotes around the filename? I tried all combinations. ghc never gave an error indicating there was something wrong with what I typed. It happily accepted all forms of -i. But it never found the libraries. Thanks, Mike

Michael Mossey wrote:
I tried using the -i options to ghc and ghci, but to no avail. It wasn't clear on Windows in what form -i takes its arguments: backslashes as usual for Windows, forward slashes perhaps? How about paths with spaces in them? Does it need quotes around the filename? I tried all combinations. ghc never gave an error indicating there was something wrong with what I typed. It happily accepted all forms of -i. But it never found the libraries.
Have you tried starting GHC with -v to see what paths it looks in? Martijn.

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. Anyway, 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 modules 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. Martijn van Steenbergen wrote:
Michael Mossey wrote:
I tried using the -i options to ghc and ghci, but to no avail. It wasn't clear on Windows in what form -i takes its arguments: backslashes as usual for Windows, forward slashes perhaps? How about paths with spaces in them? Does it need quotes around the filename? I tried all combinations. ghc never gave an error indicating there was something wrong with what I typed. It happily accepted all forms of -i. But it never found the libraries.
Have you tried starting GHC with -v to see what paths it looks in?
Martijn.

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. Anyway, 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 modules 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 http://www.haskell.org/haskellwiki/How_to_write_a_Haskell_program 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. Then 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 optionally 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.
participants (3)
-
Daniel Fischer
-
Martijn van Steenbergen
-
Michael Mossey