The Glasgow Haskell Compiler User's Guide, Version 4.06

The GHC Team


Table of Contents
The Glasgow Haskell Compiler License
1. Introduction to GHC
The (batch) compilation system components
What really happens when I “compile” a Haskell program?
Meta-information: Web sites, mailing lists, etc.
Release notes for version 4.06—1/00
2. Installing from binary distributions
Installing on Unix-a-likes
Bundle structure
Installing on Windows
System requirements
Your environment variables
Software required
Installing GHC
Installing ghc-win32 FAQ
Building the documentation
3. Using GHC
Overall command-line structure
Meaningful file suffixes
Help and verbosity options
Running the right phases in the right order
Re-directing the compilation output(s)
Saving GHC's standard error output
Redirecting temporary files
Warnings and sanity-checking
Separate compilation
Interface files
Finding interface files
Other options related to interface files
The recompilation checker
Using make
How to compile mutually recursive modules
Optimisation (code improvement)
-O*: convenient “packages” of optimisation flags.
-f*: platform-independent flags
-m*: platform-specific flags
Code improvement by the C compiler.
Options related to a particular phase
The C pre-processor
Options affecting the C compiler (if applicable)
Linking and consistency-checking
Using Concurrent Haskell
Using Parallel Haskell
Dummy's guide to using PVM
Parallelism profiles
Other useful info about running parallel programs
RTS options for Concurrent/Parallel Haskell
Running a compiled program
RTS options to control the garbage-collector
RTS options for profiling and Concurrent/Parallel Haskell
RTS options for hackers, debuggers, and over-interested souls
“Hooks” to change RTS behaviour
Debugging the compiler
Replacing the program for one or more phases.
Forcing options to a particular phase.
Dumping out compiler intermediate structures
Checking for consistency
How to read Core syntax (from some -ddump-* flags)
Command line options in source files
4. Profiling
Cost centres and cost-centre stacks
Inserting cost centres by hand
Rules for attributing costs
Profiling memory usage
Graphical time/allocation profile
Compiler options for profiling
Runtime options for profiling
hp2ps--heap profile to PostScript
Using “ticky-ticky” profiling (for implementors)
5. Advice on: sooner, faster, smaller, stingier
Sooner: producing a program more quickly
Faster: producing a program that runs quicker
Smaller: producing a program that is smaller
Stingier: producing a program that gobbles less heap space
6. GHC Language Features
Unboxed types and primitive operations
Unboxed types
Unboxed Tuples
Character and numeric types
Comparison operations
Primitive-character operations
Primitive-Int operations
Primitive-Double and Float operations
Operations on/for Integers (interface to GMP)
Words and addresses
Arrays
Reading and writing
The state type
State of the world
Mutable arrays
Synchronizing variables (M-vars)
Primitive state-transformer monad
Primitive arrays, mutable and otherwise
Calling C directly from Haskell
_ccall_ and _casm_: an introduction
Literal-literals
Using function headers
Subverting automatic unboxing with “stable pointers”
Foreign objects: pointing outside the Haskell heap
Avoiding monads
C-calling “gotchas” checklist
Multi-parameter type classes
Types
Class declarations
Instance declarations
Explicit universal quantification
Universally-quantified data type fields
Construction
Pattern matching
The partial-application restriction
Type signatures
Type synonyms and hoisting
Existentially quantified data constructors
Why existential?
Type classes
Restrictions
Assertions
Scoped Type Variables
Scope and implicit quantification
Polymorphism
Result type signatures
Pattern signatures on other constructs
Existentials
Pragmas
INLINE pragma
NOINLINE pragma
SPECIALIZE pragma
SPECIALIZE instance pragma
LINE pragma
RULES pragma
Rewrite rules
Syntax
Semantics
List fusion
Specialisation
Controlling what's going on
Concurrent and Parallel Haskell
Features specific to Parallel Haskell
Haskell 98 vs. Glasgow Haskell: language non-compliance
Expressions and patterns
Declarations and bindings
Module system and interface files
Numbers, basic types, and built-in classes
In Prelude support
7. What to do when something goes wrong
When the compiler “does the wrong thing”
When your program “does the wrong thing”
How to report a bug in the GHC system
Hard-core debugging of GHC-compiled programs
8. Other Haskell utility programs
Makefile dependencies in Haskell: using mkdependHS
Emacs `TAGS' for Haskell: hstags
“Yacc for Haskell”: happy
Pretty-printing Haskell: pphs
9. Building and using Win32 DLLs
Linking with DLLs
Not linking with DLLs
Creating a DLL