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
1.1. The (batch) compilation system components
1.2. What really happens when I “compile” a Haskell program?
1.3. Meta-information: Web sites, mailing lists, etc.
1.4. Release notes for version 4.06—1/00
2. Installing from binary distributions
2.1. Installing on Unix-a-likes
2.1.1. Bundle structure
2.2. Installing on Windows
2.2.1. System requirements
2.2.2. Your environment variables
2.2.3. Software required
2.2.4. Installing GHC
2.3. Installing ghc-win32 FAQ
3. Using GHC
3.1. Overall command-line structure
3.2. Meaningful file suffixes
3.3. Help and verbosity options
3.4. Running the right phases in the right order
3.5. Re-directing the compilation output(s)
3.5.1. Saving GHC's standard error output
3.5.2. Redirecting temporary files
3.6. Warnings and sanity-checking
3.7. Separate compilation
3.7.1. Interface files
3.7.2. Finding interface files
3.7.3. Other options related to interface files
3.7.4. The recompilation checker
3.7.5. Using make
3.7.6. How to compile mutually recursive modules
3.8. Optimisation (code improvement)
3.8.1. -O*: convenient “packages” of optimisation flags.
3.8.2. -f*: platform-independent flags
3.8.3. -m*: platform-specific flags
3.8.4. Code improvement by the C compiler.
3.9. Options related to a particular phase
3.9.1. The C pre-processor
3.9.2. Options affecting the C compiler (if applicable)
3.9.3. Linking and consistency-checking
3.10. Using Concurrent Haskell
3.11. Using Parallel Haskell
3.11.1. Dummy's guide to using PVM
3.11.2. Parallelism profiles
3.11.3. Other useful info about running parallel programs
3.11.4. RTS options for Concurrent/Parallel Haskell
3.12. Running a compiled program
3.12.1. RTS options to control the garbage-collector
3.12.2. RTS options for profiling and Concurrent/Parallel Haskell
3.12.3. RTS options for hackers, debuggers, and over-interested souls
3.12.4. “Hooks” to change RTS behaviour
3.13. Debugging the compiler
3.13.1. Replacing the program for one or more phases.
3.13.2. Forcing options to a particular phase.
3.13.3. Dumping out compiler intermediate structures
3.13.4. Checking for consistency
3.13.5. How to read Core syntax (from some -ddump-* flags)
3.13.6. Command line options in source files
4. Profiling
4.1. How to profile a Haskell program
4.2. Compiling programs for profiling
4.3. How to control your profiled program at runtime
4.4. What's in a profiling report?
4.5. Producing graphical heap profiles
4.5.1. hp2ps--heap profile to PostScript
4.5.2. stat2resid—residency info from GC stats
4.6. Using “ticky-ticky” profiling (for implementors)
5. Advice on: sooner, faster, smaller, stingier
5.1. Sooner: producing a program more quickly
5.2. Faster: producing a program that runs quicker
5.3. Smaller: producing a program that is smaller
5.4. Stingier: producing a program that gobbles less heap space
6. GHC Language Features
6.1. Unboxed types
6.2. Primitive state-transformer monad
6.3. Primitive arrays, mutable and otherwise
6.4. Calling C directly from Haskell
6.4.1. _ccall_ and _casm_: an introduction
6.4.2. Literal-literals
6.4.3. Using function headers
6.4.4. Subverting automatic unboxing with “stable pointers”
6.4.5. Foreign objects: pointing outside the Haskell heap
6.4.6. Avoiding monads
6.4.7. C-calling “gotchas” checklist
6.5. Multi-parameter type classes
6.5.1. Types
6.5.2. Class declarations
6.5.3. Instance declarations
6.6. Explicit universal quantification
6.6.1. Universally-quantified data type fields
6.6.2. Construction
6.6.3. Pattern matching
6.6.4. The partial-application restriction
6.6.5. Type signatures
6.7. Existentially quantified data constructors
6.7.1. Why existential?
6.7.2. Type classes
6.7.3. Restrictions
6.8. Assertions
6.9. Scoped Type Variables
6.9.1. Scope and implicit quantification
6.9.2. Polymorphism
6.9.3. Result type signatures
6.9.4. Pattern signatures on other constructs
6.9.5. Existentials
6.10. Pragmas
6.10.1. INLINE pragma
6.10.2. NOINLINE pragma
6.10.3. SPECIALIZE pragma
6.10.4. SPECIALIZE instance pragma
6.10.5. LINE pragma
6.10.6. RULES pragma
6.11. Rewrite rules
6.11.1. Syntax
6.11.2. Semantics
6.11.3. List fusion
6.11.4. Specialisation
6.11.5. Controlling what's going on
6.12. Concurrent and Parallel Haskell
6.12.1. Features specific to Parallel Haskell
6.13. Haskell 98 vs. Glasgow Haskell: language non-compliance
6.13.1. Expressions and patterns
6.13.2. Declarations and bindings
6.13.3. Module system and interface files
6.13.4. Numbers, basic types, and built-in classes
6.13.5. In Prelude support
7. What to do when something goes wrong
7.1. When the compiler “does the wrong thing”
7.2. When your program “does the wrong thing”
7.3. How to report a bug in the GHC system
7.4. Hard-core debugging of GHC-compiled programs
8. The GHC prelude and libraries
8.1. Prelude extensions
8.2. GHC-only Extension Libraries
8.3. The module PrelGHC: really primitive stuff
8.3.1. Unboxed Tuples
8.3.2. Character and numeric types
8.3.3. Comparison operations
8.3.4. Primitive-character operations
8.3.5. Primitive-Int operations
8.3.6. Primitive-Double and Float operations
8.3.7. Operations on/for Integers (interface to GMP)
8.3.8. Words and addresses
8.3.9. Arrays
8.3.10. Reading and writing
8.3.11. The state type
8.3.12. State of the world
8.3.13. Mutable arrays
8.3.14. Synchronizing variables (M-vars)
9. Other Haskell utility programs
9.1. Makefile dependencies in Haskell: using mkdependHS
9.2. Emacs `TAGS' for Haskell: hstags
9.3. “Yacc for Haskell”: happy
9.4. Pretty-printing Haskell: pphs
10. Building and using Win32 DLLs
10.1. Linking with DLLs
10.2. Not linking with DLLs
10.3. Creating a DLL