[Haskell] how to use GHC's prof tools

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Fri Apr 8 11:20:28 EDT 2005

On Fri, 2005-04-08 at 11:01 -0400, haitao.wu at yale.edu wrote:
> Hi,
> I developed a program based on wxHaskell but it has serious performance
> problem. So I tried to compile the program using "-prof" in GHC. 
> If I use "ghc --make -fglasgow-exts -package wx -prof Main.lhs", it
> always reports that it cannot find modules defined in wxHaskell like
> WXCore. However, if I compile it without the "-prof" option, it works
> well and can generate "a.out".
> Anyone can give any help?

The problem is that wxHaskell does not come with profiling versions of
its libraries.

You see, for GHC's profiling everything needs to be compiled with
profiling support. This is because the profiling and non-profiling
styles are not compatible, for example the profiling version adds extra
hidden arguments to functions and various other things to actualy do the

So for example the libraries that come with GHC itself have to copies,
the profiling and non-porofiling verions. For many other libraries this
is unfortunately not the case since the build infrastructure to produce
two copies of everything is not so trivial to do (I think).

You can probably rebuild wxHaskell with profiling support (though it may
not be so trivial since the it changes the names of various files by
adding _p extensions here and there so the build system may not like
it). Ask about it on the wxHaskell list:
wxhaskell-users at lists.sourceforge.net

This leads onto a cabal feature request. Can we have a parameter to
build profiling versions of libraries in addition to the normal version?


More information about the Haskell mailing list