Inspecting reduced/optimized code

andrew cooke andrew at acooke.org
Mon Nov 10 08:50:41 EST 2003


Is it possible/easy in any of the compilers/interpreters to see what the
results of rewriting/optimisations are?  (I'm sure it is *possible*, I'm
really asking if any produce simple output in a well documented format
that I'm likely to understand).

The reason I ask is because I'm curious whether the "well known" fold
(foldr) (I don't have it to hand, but it's something like fold (\x g -> \n
-> g x n) id) that is equivalent to foldl generates the same code as foldl
itself (ie defined recursively).

I know I can do timing, or look at the C code from GHC, which would tell
me whether they are identical, I guess, but I was hoping for something
higher level (I suupose transformed Haskell code is too much to ask for?).
 Should I be looking at some kind of debugging tool (never used a debugger
in Haskell)?

Thanks,
Andrew

PS Despite its sweet naivete, this post comes from a balding middle aged
programmer looking for something to relieve the tedium of working shifts
away from home, and not some grasping, lazy, evil student that wants to
save time on homework to indulge in yet more wild, drunken orgies [sighs
wistfully, looks at clock, gets back to work...].

-- 
http://www.acooke.org/andrew


More information about the Haskell mailing list