The Glasgow Haskell Compiler User's Guide, Version 4.08

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.08 (July 2000)
1.4.1. User-visible compiler changes
1.4.2. User-visible library changes
1.4.3. Internal changes
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. Software required
2.2.3. Installing GHC
2.2.4. Installing ghc-win32 FAQ
2.3. Building the documentation
2.3.1. Installing the DocBook tools from RPMs
2.3.2. Installing from binaries on Windows
2.3.3. Installing the DocBook tools from source
2.3.4. Configuring the DocBook tools
2.3.5. Remaining problems
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. Dependency generation
3.7.7. 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. Cost centres and cost-centre stacks
4.1.1. Inserting cost centres by hand
4.1.2. Rules for attributing costs
4.2. Profiling memory usage
4.3. Graphical time/allocation profile
4.4. Compiler options for profiling
4.5. Runtime options for profiling
4.6. hp2ps--heap profile to PostScript
4.7. 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 and primitive operations
6.1.1. Unboxed types
6.1.2. Unboxed Tuples
6.1.3. Character and numeric types
6.1.4. Comparison operations
6.1.5. Primitive-character operations
6.1.6. Primitive-Int operations
6.1.7. Primitive-Double and Float operations
6.1.8. Operations on/for Integers (interface to GMP)
6.1.9. Words and addresses
6.1.10. Arrays
6.1.11. Reading and writing
6.1.12. The state type
6.1.13. State of the world
6.1.14. Mutable arrays
6.1.15. Synchronizing variables (M-vars)
6.2. Primitive state-transformer monad
6.3. Primitive arrays, mutable and otherwise
6.4. Pattern guards
6.5. The foreign interface
6.5.1. Using function headers
6.6. Multi-parameter type classes
6.6.1. Types
6.6.2. Class declarations
6.6.3. Instance declarations
6.7. Explicit universal quantification
6.7.1. Universally-quantified data type fields
6.7.2. Construction
6.7.3. Pattern matching
6.7.4. The partial-application restriction
6.7.5. Type signatures
6.7.6. Type synonyms and hoisting
6.8. Existentially quantified data constructors
6.8.1. Why existential?
6.8.2. Type classes
6.8.3. Restrictions
6.9. Assertions
6.10. Scoped Type Variables
6.10.1. Scope and implicit quantification
6.10.2. Polymorphism
6.10.3. Result type signatures
6.10.4. Pattern signatures on other constructs
6.10.5. Existentials
6.11. Pragmas
6.11.1. INLINE pragma
6.11.2. NOINLINE pragma
6.11.3. SPECIALIZE pragma
6.11.4. SPECIALIZE instance pragma
6.11.5. LINE pragma
6.11.6. RULES pragma
6.12. Rewrite rules
6.12.1. Syntax
6.12.2. Semantics
6.12.3. List fusion
6.12.4. Specialisation
6.12.5. Controlling what's going on
6.13. Concurrent and Parallel Haskell
6.13.1. Features specific to Parallel Haskell
6.14. Haskell 98 vs. Glasgow Haskell: language non-compliance
6.14.1. Expressions and patterns
6.14.2. Declarations and bindings
6.14.3. Module system and interface files
6.14.4. Numbers, basic types, and built-in classes
6.14.5. In Prelude support
7. Foreign function interface
7.1. Introduction
7.2. Calling foreign functions
7.2.1. Giving the external function a Haskell name
7.2.2. Naming the external function
7.2.3. Calling conventions
7.2.4. External function types
7.2.5. Type mapping
7.2.6. Some foreign import wrinkles
7.3. Invoking external functions via a pointer
7.4. Exposing Haskell functions
7.4.1. Exposing Haskell function values
7.4.2. Code addresses
8. What to do when something goes wrong
8.1. When the compiler “does the wrong thing”
8.2. When your program “does the wrong thing”
8.3. How to report a bug in the GHC system
8.4. Hard-core debugging of GHC-compiled programs
9. Other Haskell utility programs
9.1. Emacs `TAGS' for Haskell: hstags
9.2. “Yacc for Haskell”: happy
9.3. 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