Introduction to GHCThis 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 , and a batch compiler, described throughout . 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
.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 for more
details.GHC comes with a large collection of libraries, with
everything from parser combinators to networking. The libraries are
described in separate documentation.Meta-information: Web sites, mailing lists, etc.mailing lists, Glasgow HaskellGlasgow Haskell mailing listsOn the World-Wide Web, there are several URLs of likely
interest:Haskell home
pageGHC home
pagecomp.lang.functional
FAQWe run the following mailing lists about Glasgow Haskell.
We encourage you to join, as you feel is appropriate.glasgow-haskell-users:This list is for GHC users to chat among themselves.
If you have a specific question about GHC, please check the
FAQ first ().list email address:glasgow-haskell-users@haskell.orgsubscribe at:http://www.haskell.org/mailman/listinfo/glasgow-haskell-users.admin email address:glasgow-haskell-users-admin@haskell.orglist archives:http://www.haskell.org/pipermail/glasgow-haskell-users/glasgow-haskell-bugs:Send bug reports for GHC to this address! The sad and
lonely people who subscribe to this list will muse upon
what's wrong and what you might do about it.list email address:glasgow-haskell-bugs@haskell.orgsubscribe at:http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs.admin email address:glasgow-haskell-bugs-admin@haskell.orglist archives:http://www.haskell.org/pipermail/glasgow-haskell-bugs/cvs-ghc:The hardcore GHC developers hang out here. This list
also gets commit message from the CVS repository. There are
several other similar lists for other parts of the CVS
repository (eg. cvs-hslibs,
cvs-happy, cvs-hdirect
etc.)list email address:cvs-ghc@haskell.orgsubscribe at:http://www.haskell.org/mailman/listinfo/cvs-ghc.admin email address:cvs-ghc-admin@haskell.orglist archives:http://www.haskell.org/pipermail/cvs-ghc/There are several other haskell and GHC-related mailing
lists served by www.haskell.org. Go to http://www.haskell.org/mailman/listinfo/
for the full list.Some Haskell-related discussion also takes place in the
Usenet newsgroup comp.lang.functional.Reporting bugs in GHCbugsreportingreporting bugsGlasgow Haskell is a changing system so there are sure to be
bugs in it. To report a bug, either:Go to the SoureForge GHC
page, go to the bugs section, click on
submit, and enter your bug report. You can also
check the outstanding bugs here and search the archives to make
sure it hasn't already been reported. Or:Email your bug report to
glasgow-haskell-bugs@haskell.org. How do I tell if I should report my bug?Take a look at the FAQ () and , which will give you some guidance as to
whether the behaviour you're seeing is really a bug or
not.If it is a bug, then it might have been reported before:
try searching the mailing list archives. The archives don't
have a built-in search facility, but we find that Google's site search works
pretty well: enter
site:www.haskell.org followed
by your search term into Google.If in doubt, just report it.What to put in a bug reportbug reportscontentsThe name of the bug-reporting game is: facts, facts,
facts. Don't omit them because “Oh, they won't be
interested…”What kind of machine are you running on, and exactly
what version of the operating system are you using?
(on a Unix system, uname -a or cat
/etc/motd will show the desired information.) What version of GCC are you using? gcc
-v will tell you. Run the sequence of compiles/runs that caused the
offending behaviour, capturing all the input/output in a
“script” (a UNIX command) or in an Emacs shell
window. We'd prefer to see the whole thing. Be sure any Haskell compilations are run with a
(verbose) flag, so we can see exactly
what was run, what versions of things you have, etc. What is the program behaviour that is wrong, in your
opinion? If practical, please send enough source files for us
to duplicate the problem. If you are a Hero and track down the problem in the
compilation-system sources, please send us patches relative
to a known released version of GHC, or whole files if you
prefer.GHC version numbering policyversion, of ghcAs of GHC version 4.08, we have adopted the following
policy for numbering GHC versions:Stable ReleasesThese are numbered x.yy.z, where
yy is even, and
z is the patchlevel number (the trailing
.z can be omitted if z
is zero). Patchlevels are bug-fix releases only, and never
change the programmer interface to any system-supplied code.
However, if you install a new patchlevel over an old one you
will need to recompile any code that was compiled against the
old libraries.The value of __GLASGOW_HASKELL__
(see ) for a major release
x.yy.z is the integer
xyy.__GLASGOW_HASKELL__Snapshots/unstable releasesWe may make snapshot releases of the current
development sources from time to time, and the current
sources are always available via the CVS repository (see the
GHC web site for details).Snapshot releases are named
x.yy.YYYYMMDD where yy
is odd, and YYYYMMDD
is the date of the sources from which the snapshot was
built. In theory, you can check out the exact same sources
from the CVS repository using this date.The value of __GLASGOW_HASKELL__
for a snapshot release is the integer
xyy. You should never write any
conditional code which tests for this value, however: since
interfaces change on a day-to-day basis, and we don't have
finer granularity in the values of
__GLASGOW_HASKELL__, you should only
conditionally compile using predicates which test whether
__GLASGOW_HASKELL__ is equal to, later
than, or earlier than a given major release.__GLASGOW_HASKELL__The version number of your copy of GHC can be found by
invoking ghc with the
––version flag (see ).
&relnotes;