[Haskell-beginners] Understanding Haskell fcn calls

blackcat at pro-ns.net blackcat at pro-ns.net
Wed Feb 16 23:49:51 CET 2011


When I learn a new language, I like to look at the assembly code for 
some simple fcn calls.  I tried GHC -S on the following program:

    add' x y = x + y

    main = do
       print $ add' 1 2


The result of  ghc -S add.hs  was 301 lines of assembly code. Adding 
an explicit type annotation for add' brought it down to 252 lines, and 
the code was still beyond my meager ability to take in assembly.

Is there a good reference that gives a simple explanation of how 
Haskell function calls work?  This seems crucial to understanding how 
to efficiently use the language, given what I've read about tail call 
optimization.

thanks
Lee Short




More information about the Beginners mailing list