darcs patch: Add flag to disable linking in build

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Mon Feb 16 15:36:41 EST 2009


On Mon, 2009-02-16 at 03:56 +1300, hamish at firestream.co.uk wrote:
> Mon Feb 16 03:52:49 NZDT 2009  hamish at firestream.co.uk
>   * Add flag to disable linking in build 
>   This is usefull when you just want to find compiler errors (eg. for background compilation while editing).  Only implemented for GHC (others will die with an error if linking is disabled).


Hi Hamish, thanks for sending in the patch.

It's a good idea to have a mode to just do checking rather than
everything necessary to use or install a package.

There are some improvements we could make to this patch:

I think the user interface should reflect the fact that it is for
checking only. I know that your current implementation does that by
omitting linking but we could well imagine omitting more things like
code generation. So having the UI talk about linking seems to be talking
about internals rather than the users intention.

In general the patch touches too many lines of code. It also seems to
have many changes that are only white space changes eg:
-      let arVerbosity | verbosity >= deafening = "v"
-                      | verbosity >= normal = ""
-                      | otherwise = "c"
+          let arVerbosity | verbosity >= deafening = "v"
+                          | verbosity >= normal = ""
+                          | otherwise = "c"

We should not mix this kind of aesthetic change with functional changes.

I think we could make the change less invasive if we made the parameter
a member of the LocalBuildInfo rather than passing the linking bool
variable as an extra parameter in so many places. The LocalBuildInfo
already tells us things that the user has instructed like if we're doing
profiling or not. Only checking would seem to fall into the same
category of information.

I mentioned above that we might like to also omit code generation. It
turns out that ghc has a flag `-fno-code`. However it also turns out not
to work with the `--make` mode that Cabal uses. I filed a ticket about
this so it may get fixed in future.
http://hackage.haskell.org/trac/ghc/ticket/3032


Duncan



More information about the cabal-devel mailing list