<div dir="ltr">I love GHC's profiling support, and like to use it to analyze the performance of my Haskell applications. However, profiling an application is difficult when it depends on any third-party libraries, as cabal doesn't include profiling information by default.<div>
<br></div><div>Fortunately, cabal can reinstall a library with profiling support, with:</div><div><br></div><div>cabal install --reinstall -p <library></div><div><br></div><div>Unfortunately, cabal is a bit of a simpleton, so this will fail unless that libraries dependencies are also installed with profiling enabled:</div>
<div><br></div><div>cabal install --reinstall -p <libraryX> <libraryY> <libraryZ> ...</div><div><br></div><div>For example, a user who wants to profile his die-rolling program must run:</div><div><br></div>
<div>$ sudo apt-get install haskell-platform haskell-platform-doc haskell-platform-prof<br></div><div>$ <span style="color:rgb(0,0,0);white-space:pre-wrap">sudo cabal install --reinstall -p mwc-random rvar random-fu random-source mersenne-random-pure64 stateref flexible-defaults th-extras MonadPrompt math-functions erf vector-th-unbox monad-loops random-shuffle MonadRandom</span></div>
<div><br></div><div>And that long list of packages must be slowly grown one at a time, starting from random-source, based on many attempts at running cabal install --reinstall -p ..., waiting several minutes for compilation to partially complete, and scrolling back up through the logs to track down which dependencies also neglected to compile with profiling enabled.</div>
<div><br></div><div>It can take a while to get a list of this long, full dependency chain. It would be much easier if cabal simply enabled `-p` by default, so we didn't have to think about it.</div><div><br></div><div>
What do you think?<br clear="all"><div><br></div>-- <br><div></div>Cheers,<div><br></div><div>Andrew Pennebaker</div><div><a href="http://www.yellosoft.us" target="_blank">www.yellosoft.us</a></div>
</div></div>