1 <?xml version="1.0" encoding="iso-8859-1"?>
2 <chapter id="introduction-GHC">
3 <title>Introduction to GHC</title>
5 <para>This is a guide to using the Glasgow Haskell Compiler (GHC):
6 an interactive and batch compilation system for the <ulink
7 url="http://www.haskell.org/">Haskell 98</ulink>
10 <para>GHC has two main components: an interactive Haskell
11 interpreter (also known as GHCi), described in <xref
12 linkend="ghci"/>, and a batch compiler, described throughout <xref
13 linkend="using-ghc"/>. In fact, GHC consists of a single program
14 which is just run with different options to provide either the
15 interactive or the batch system.</para>
17 <para>The batch compiler can be used alongside GHCi: compiled
18 modules can be loaded into an interactive session and used in the
19 same way as interpreted code, and in fact when using GHCi most of
20 the library code will be pre-compiled. This means you get the best
21 of both worlds: fast pre-compiled library code, and fast compile
22 turnaround for the parts of your program being actively
25 <para>GHC supports numerous language extensions, including
26 concurrency, a foreign function interface, exceptions, type system
27 extensions such as multi-parameter type classes, local universal and
28 existential quantification, functional dependencies, scoped type
29 variables and explicit unboxed types. These are all described in
30 <xref linkend="ghc-language-features"/>.</para>
32 <para>GHC has a comprehensive optimiser, so when you want to Really
33 Go For It (and you've got time to spare) GHC can produce pretty fast
34 code. Alternatively, the default option is to compile as fast as
35 possible while not making too much effort to optimise the generated
36 code (although GHC probably isn't what you'd describe as a fast
39 <para>GHC's profiling system supports “cost centre
40 stacks”: a way of seeing the profile of a Haskell program in a
41 call-graph like structure. See <xref linkend="profiling"/> for more
44 <para>GHC comes with a number of libraries. These are
45 described in separate documentation.</para>
47 <sect1 id="mailing-lists-GHC">
48 <title>Meta-information: Web sites, mailing lists, etc.</title>
50 <indexterm><primary>mailing lists, Glasgow Haskell</primary></indexterm>
51 <indexterm><primary>Glasgow Haskell mailing lists</primary></indexterm>
53 <para>On the World-Wide Web, there are several URLs of likely
58 <para><ulink url="http://www.haskell.org/" >Haskell home
63 <para><ulink url="http://www.haskell.org/ghc/">GHC home
69 url="http://www.cs.nott.ac.uk/~gmh/faq.html">comp.lang.functional
75 <para>We run the following mailing lists about Glasgow Haskell.
76 We encourage you to join, as you feel is appropriate.</para>
80 <term>glasgow-haskell-users:</term>
82 <para>This list is for GHC users to chat among themselves.
83 If you have a specific question about GHC, please check the
85 url="http://haskell.org/haskellwiki/GHC/FAQ">FAQ</ulink>
90 <term>list email address:</term>
92 <para><email>glasgow-haskell-users@haskell.org</email></para>
97 <term>subscribe at:</term>
100 url="http://www.haskell.org/mailman/listinfo/glasgow-haskell-users"><literal>http://www.haskell.org/mailman/listinfo/glasgow-haskell-users</literal></ulink>.</para>
105 <term>admin email address:</term>
107 <para><email>glasgow-haskell-users-admin@haskell.org</email></para>
112 <term>list archives:</term>
115 url="http://www.haskell.org/pipermail/glasgow-haskell-users/"><literal>http://www.haskell.org/pipermail/glasgow-haskell-users/</literal></ulink></para>
123 <term>cvs-ghc:</term>
125 <para>The hardcore GHC developers hang out here. This list
126 also gets commit message from the CVS repository. There are
127 several other similar lists for other parts of the CVS
128 repository (eg. <literal>cvs-hslibs</literal>,
129 <literal>cvs-happy</literal>, <literal>cvs-hdirect</literal>
134 <term>list email address:</term>
136 <para><email>cvs-ghc@haskell.org</email></para>
141 <term>subscribe at:</term>
144 url="http://www.haskell.org/mailman/listinfo/cvs-ghc"><literal>http://www.haskell.org/mailman/listinfo/cvs-ghc</literal></ulink>.</para>
149 <term>admin email address:</term>
151 <para><email>cvs-ghc-admin@haskell.org</email></para>
156 <term>list archives:</term>
159 url="http://www.haskell.org/pipermail/cvs-ghc/"><literal>http://www.haskell.org/pipermail/cvs-ghc/</literal></ulink></para>
167 <para>There are several other haskell and GHC-related mailing
168 lists served by <literal>www.haskell.org</literal>. Go to <ulink
169 url="http://www.haskell.org/mailman/listinfo/"><literal>http://www.haskell.org/mailman/listinfo/</literal></ulink>
170 for the full list.</para>
172 <para>Some Haskell-related discussion also takes place in the
173 Usenet newsgroup <literal>comp.lang.functional</literal>.</para>
177 <sect1 id="bug-reporting">
178 <title>Reporting bugs in GHC</title>
179 <indexterm><primary>bugs</primary><secondary>reporting</secondary>
181 <indexterm><primary>reporting bugs</primary>
185 Glasgow Haskell is a changing system so there are sure to be
186 bugs in it. If you find one, please see
187 <ulink url="http://hackage.haskell.org/trac/ghc/wiki/ReportABug">this wiki page</ulink>
188 for information on how to report it.
193 <sect1 id="version-numbering">
194 <title>GHC version numbering policy</title>
195 <indexterm><primary>version, of ghc</primary></indexterm>
197 <para>As of GHC version 6.8, we have adopted the following policy
198 for numbering GHC versions:</para>
202 <term>Stable Releases</term>
204 <para>Stable branches are numbered <literal><replaceable>x</replaceable>.<replaceable>y</replaceable></literal>, where
205 <replaceable>y</replaceable> is <emphasis>even</emphasis>.
206 Releases on the stable branch <literal><replaceable>x</replaceable>.<replaceable>y</replaceable></literal> are numbered <literal><replaceable>x</replaceable>.<replaceable>y</replaceable>.<replaceable>z</replaceable></literal>, where
207 <replaceable>z</replaceable> (>= 1) is the patchlevel number.
208 Patchlevels are bug-fix releases only, and never
209 change the programmer interface to any system-supplied code.
210 However, if you install a new patchlevel over an old one you
211 will need to recompile any code that was compiled against the
212 old libraries.</para>
214 <para>The value of <literal>__GLASGOW_HASKELL__</literal>
215 (see <xref linkend="c-pre-processor"/>) for a major release
216 <literal><replaceable>x</replaceable>.<replaceable>y</replaceable>.<replaceable>z</replaceable></literal>
217 is the integer <replaceable>xyy</replaceable> (if
218 <replaceable>y</replaceable> is a single digit, then a leading zero
219 is added, so for example in version 6.8.2 of GHC we would have
220 <literal>__GLASGOW_HASKELL__==608</literal>).</para>
222 <primary><literal>__GLASGOW_HASKELL__</literal></primary>
228 <term>Stable snapshots</term>
231 We may make snapshot releases of the current
232 stable branch <ulink url="http://www.haskell.org/ghc/dist/stable/dist/">available for download</ulink>, and the latest sources are available from <ulink url="http://hackage.haskell.org/trac/ghc/wiki/DarcsRepositories">the darcs repositories</ulink>.
235 <para>Stable snapshot releases are named
236 <literal><replaceable>x</replaceable>.<replaceable>y</replaceable>.<replaceable>z</replaceable>.<replaceable>YYYYMMDD</replaceable></literal>.
237 where <literal><replaceable>YYYYMMDD</replaceable></literal> is the date of the sources
238 from which the snapshot was built, and <literal><replaceable>x</replaceable>.<replaceable>y</replaceable>.<replaceable>z+1</replaceable></literal> is the next release to be made on that branch.
239 For example, <literal>6.8.1.20040225</literal> would be a
240 snapshot of the <literal>6.8</literal> branch during the development
241 of <literal>6.8.2</literal>.</para>
243 <para>The value of <literal>__GLASGOW_HASKELL__</literal>
244 for a snapshot release is the integer
245 <replaceable>xyy</replaceable>. You should never write any
246 conditional code which tests for this value, however: since
247 interfaces change on a day-to-day basis, and we don't have
248 finer granularity in the values of
249 <literal>__GLASGOW_HASKELL__</literal>, you should only
250 conditionally compile using predicates which test whether
251 <literal>__GLASGOW_HASKELL__</literal> is equal to, later
252 than, or earlier than a given major release.</para>
254 <primary><literal>__GLASGOW_HASKELL__</literal></primary>
260 <term>Unstable snapshots</term>
263 We may make snapshot releases of the
264 HEAD <ulink url="http://www.haskell.org/ghc/dist/current/dist/">available for download</ulink>, and the latest sources are available from <ulink url="http://hackage.haskell.org/trac/ghc/wiki/DarcsRepositories">the darcs repositories</ulink>.
267 <para>Unstable snapshot releases are named
268 <literal><replaceable>x</replaceable>.<replaceable>y</replaceable>.<replaceable>YYYYMMDD</replaceable></literal>.
269 where <literal><replaceable>YYYYMMDD</replaceable></literal> is the date of the sources
270 from which the snapshot was built.
271 For example, <literal>6.7.20040225</literal> would be a
272 snapshot of the HEAD before the creation of the
273 <literal>6.8</literal> branch.</para>
275 <para>The value of <literal>__GLASGOW_HASKELL__</literal>
276 for a snapshot release is the integer
277 <replaceable>xyy</replaceable>. You should never write any
278 conditional code which tests for this value, however: since
279 interfaces change on a day-to-day basis, and we don't have
280 finer granularity in the values of
281 <literal>__GLASGOW_HASKELL__</literal>, you should only
282 conditionally compile using predicates which test whether
283 <literal>__GLASGOW_HASKELL__</literal> is equal to, later
284 than, or earlier than a given major release.</para>
286 <primary><literal>__GLASGOW_HASKELL__</literal></primary>
292 <para>The version number of your copy of GHC can be found by
293 invoking <literal>ghc</literal> with the
294 <literal>––version</literal> flag (see <xref
295 linkend="options-help"/>).</para>
304 ;;; Local Variables: ***
306 ;;; sgml-parent-document: ("users_guide.xml" "book" "chapter") ***