Chapter 1. Introduction to GHC

Table of Contents

1.1. Obtaining GHC
1.2. Meta-information: Web sites, mailing lists, etc.
1.3. Reporting bugs in GHC
1.4. GHC version numbering policy
1.5. Release notes for version 7.2.1
1.5.1. Highlights
1.5.2. Language changes
1.5.3. Warnings
1.5.4. Dumps
1.5.5. Runtime system
1.5.6. Compiler
1.5.7. GHCi
1.5.8. ghc-pkg
1.5.9. hsc2hs
1.5.10. GHC API
1.5.11. Build System and Infrastructure
1.5.12. Libraries
1.5.12.1. array
1.5.12.2. base
1.5.12.3. bin-package-db
1.5.12.4. binary
1.5.12.5. bytestring
1.5.12.6. Cabal
1.5.12.7. containers
1.5.12.8. directory
1.5.12.9. extensible-exceptions
1.5.12.10. filepath
1.5.12.11. ghc-binary
1.5.12.12. ghc-prim
1.5.12.13. haskell98
1.5.12.14. haskell2010
1.5.12.15. hoopl
1.5.12.16. hpc
1.5.12.17. integer-gmp
1.5.12.18. old-locale
1.5.12.19. old-time
1.5.12.20. pretty
1.5.12.21. process
1.5.12.22. random
1.5.12.23. template-haskell
1.5.12.24. time
1.5.12.25. unix
1.5.12.26. Win32

This is a guide to using the Glasgow Haskell Compiler (GHC): an interactive and batch compilation system for the Haskell 98 language.

GHC has two main components: an interactive Haskell interpreter (also known as GHCi), described in Chapter 2, Using GHCi, and a batch compiler, described throughout Chapter 4, Using GHC. In fact, GHC consists of a single program which is just run with different options to provide either the interactive or the batch system.

The batch compiler can be used alongside GHCi: compiled modules can be loaded into an interactive session and used in the same way as interpreted code, and in fact when using GHCi most of the library code will be pre-compiled. This means you get the best of both worlds: fast pre-compiled library code, and fast compile turnaround for the parts of your program being actively developed.

GHC supports numerous language extensions, including concurrency, a foreign function interface, exceptions, type system extensions such as multi-parameter type classes, local universal and existential quantification, functional dependencies, scoped type variables and explicit unboxed types. These are all described in Chapter 7, GHC Language Features.

GHC has a comprehensive optimiser, so when you want to Really Go For It (and you've got time to spare) GHC can produce pretty fast code. Alternatively, the default option is to compile as fast as possible while not making too much effort to optimise the generated code (although GHC probably isn't what you'd describe as a fast compiler :-).

GHC's profiling system supports “cost centre stacks”: a way of seeing the profile of a Haskell program in a call-graph like structure. See Chapter 5, Profiling for more details.

GHC comes with a number of libraries. These are described in separate documentation.

1.1. Obtaining GHC

Go to the GHC home page and follow the "download" link to download GHC for your platform.

Alternatively, if you want to build GHC yourself, head on over to the GHC Building Guide to find out how to get the sources, and build it on your system. Note that GHC itself is written in Haskell, so you will still need to install GHC in order to build it.