Go to the first, previous, next, last section, table of contents.

What really happens when I "compile" a Haskell program?

You invoke the Glasgow Haskell compilation system through the driver program `ghc'. For example, if you had typed a literate "Hello, world!" program into `hello.lhs', and you then invoked:

ghc hello.lhs

the following would happen:

  1. The file `hello.lhs' is run through the literate-program code extractor `unlit', feeding its output to
  2. The Haskell compiler proper `hsc', which produces input for
  3. The assembler (or that ubiquitous "high-level assembler," a C compiler), which produces an object file and passes it to
  4. The linker, which links your code with the appropriate libraries (including the standard prelude), producing an executable program in the default output file named `a.out'.

You have considerable control over the compilation process. You feed command-line arguments (call them "options," for short) to the driver, `ghc'; the "types" of the input files (as encoded in their names' suffixes) also matter.

Here's hoping this is enough background so that you can read the rest of this guide!


Go to the first, previous, next, last section, table of contents.