Perspectives on learning and using Haskell

Sven Panne Sven.Panne at aedion.de
Mon Jan 5 19:29:51 EST 2004


Duncan Coutts wrote:
> On Sun, 2004-01-04 at 10:20, Graham Klyne wrote:
>> [...]  I would expect that when using GHC to compile a 
>>stand-alone Haskell program, any expressions that are not referenced are 
>>not included in the final object program, so leaving these test cases 
>>uncommented would be harmless:  is this so?
> 
> If your test functions are not exported, I would expect that this is the
> case. [...]

Yes, unused functions which are not exported are nuked during compilation,
even without using the -O flag. But don't guess, just ask GHC itself via its
-ddump-occur-anal flag. (DISCLAIMER: I'm not responsible for the, well,
slightly obscure name of this flag! :-)   There are a lot more flags of this
kind, see:

    http://haskell.org/ghc/docs/latest/html/users_guide/options-debugging.html#DUMPING-OUTPUT

When you are *really* curious, use -v5.

Simon^2: The -ddump-all and -ddump-most flags mentioned on the page above are
not working anymore, -v5 / -v4 seem to do their job now. Should the documentation
be fixed or GHC?

Cheers,
    S.




More information about the Haskell-Cafe mailing list