Talk:Haskell/Packaging

From Wikibooks, the open-content textbooks collection

Jump to: navigation, search

Contents

[edit] Thank you

Im learning haskell for some weeks now and I am very impressed how fast I can setup a reliable build-system. In Java something like this is soo complicated (integrating: ant, mvn, make, cvs, svn, junit). This page was absolutly to the point for me: We have an evolving project, and I setup everything according to this guide in 1,5 hours. Great!!

-- bastl (delete the comment when you read it.)

[edit] Nonroot installs

A small tip to add to this page :

if you want to install your project on a simple user account, you should do :

runhaskell Setup.lhs configure --prefix=$HOME --user

this way, installation won't try to edit a system file.


thanks for this great wikibook by the way, it is of great help !

Happy to hear that. I've tacked on the --user flag to each of our configure options -- Kowey 04:09, 22 August 2007 (UTC)

[edit] Handling GHC extensions

Another missing information (actually I didn't find this information anywhere else yet) :

When your code is using GHC extensions (-fglasgow-exts), how do you handle this ? Is is in the cabal file ? Is it some kind of header at the beginning of the sources ?

-- Thomas

PS : I found my answer ... {-# OPTIONS -fglasgow-exts #-} at the beginning of the code. Is this information appearing anywhere in this wikibook ?

I don't think so, but I suppose it could be mentioned in this module -- Kowey 16:10, 24 August 2007 (UTC)
That would work anon, but it'd be even better to use {-# OPTIONS_GHC -fglasgow-exts #-}, so in the (unlikely :) case someone wants to use the code with Hugs/NHC/YHC/JHC/EHC, they don't try to use it.
There's a better way to do it with the LANGUAGE pragmas, but I'll just add that to the page. --Gwern (contribs)
I think there's another way you could do it, by adding the 'ghc-options:' field to the cabal file and then --fglasgow-exts. (Probably.) --24.184.131.16 00:02, 4 September 2007 (UTC)
Yes, that'd work, except it'd be '-fglasgow-exts', not '--fglasgow-exts' - the only '--' option is '--make'. --Gwern (contribs)

[edit] Testing script problems

The main function in Tests.hs doesn't work so well for me when invoked from darcs. The problem is that it doesn't return a non-zero exit code in case of failure so darcs will think that everything is alright even though the tests failed. The way I solved this was to use the alternate testing function quickCheck' for all my tests. It returns a boolean which reports if the test when through. Beware though that I'm using QuickCheck 2 so the function might not exist in QuickCheck 1, I haven't checked. Then I used System.Exit.exitFailure in case a test failed. Looks like this:

 main = mapM_ runTest tests
   where runTest (s,a) = do printf "%-25s :" s
                            b <- a
                            if b 
                              then return ()
                              else exitFailure

-- Josef Svenningsson