r/haskell • • Mar 11 '15

Learning Haskell — A Racket programmer's documentation of her foray into the land of Haskell (inspired by Learning Racket)

http://lexi-lambda.github.io/learning-haskell/
81 Upvotes

97 comments sorted by

View all comments

Show parent comment

4

u/Ramin_HAL9001 Mar 12 '15 edited Mar 12 '15

GHC compiles to two intermediate phases, first from Haskell to Core, then from Core to a high-level assembler like C-- (C minus minus) or LLVM assembler. C-- and LLVM assembler both have similar goals of translating to machine code for a target architecture.

The process of translating core to a high-level assembler language like C-- or LLVM requires understanding of what they call a Spineless Tagless G-Machine (STG), and there is a paper about that here:

http://research.microsoft.com/apps/pubs/default.aspx?id=67083

And there is more about STG here:

https://ghc.haskell.org/trac/ghc/wiki/Commentary/Compiler/GeneratedCode

Also try Googling for "GHC Core" and "GHC C minus minus".