[Haskell-cafe] Tricks for making low level haskell hacking easier

Donald Bruce Stewart dons at cse.unsw.edu.au
Sat Feb 10 00:45:02 EST 2007

For those of you who like your Haskell code fast, then, if you're like
me, reading Core output all day can give you headaches.

Here's a couple of tricks I use to make optimising low level stuff easier.

1) Use Hscolour to pretty-ifiy the Core so its more parsable:

    ghc -O Foo.hs -ddump-simpl | HsColour -tty | less -r
will colourise the Core, and pipe it into less (which will display the
metachars). A screenshot:


2) Use vimdiff on asm output, checking the results for different ghc / gcc flags.

Yes, sometimes you get down to the asm level, and it can make all the
difference. It is useful when writing (*cough*) entries for the great language
shootout, to compare the asm output. Currently I do this by compiling a program
with different flags, or slightly different code, with -keep-tmp-files
-no-recomp set, and then vimdiff the resulting asm files:


(before on the left, after generating pentium4 instructions on the right).

Do people have any other tricks for making the tweaking of low level ghc output
easier (that we should incorporate into vim/emacs support)? 
-- Don

More information about the Haskell-Cafe mailing list