[project @ 2000-04-07 15:24:15 by simonpj]
[ghc-hetmet.git] / ghc / docs / users_guide / using.sgml
index 2a9dc56..595e13d 100644 (file)
@@ -835,9 +835,10 @@ country.
 <Para>
 <IndexTerm><Primary>-syslib &lt;lib&gt; option</Primary></IndexTerm>
 If you are using a system-supplied non-Prelude library (e.g., the
-POSIX library), just use a <Option>-syslib posix</Option> option (for example).  The
-right interface files should then be available.  <XRef LinkEnd="ghc-prelude"> lists the
-libraries available by this mechanism.
+POSIX library), just use a <Option>-syslib posix</Option> option (for
+example).  The right interface files should then be available.  The
+accompanying HsLibs document lists the libraries available by this
+mechanism.
 </Para>
 </ListItem>
 </VarListEntry>
@@ -925,24 +926,50 @@ Haskell libraries.
 <Title>The recompilation checker
 </Title>
 
-<Para>
 <IndexTerm><Primary>recompilation checker</Primary></IndexTerm>
-</Para>
 
 <Para>
-In the olden days, GHC compared the newly-generated <Filename>.hi</Filename> file with
-the previous version; if they were identical, it left the old one
-alone and didn't change its modification date.  In consequence,
-importers of a module with an unchanged output <Filename>.hi</Filename> file were not
+<variablelist>
+<VarListEntry>
+<Term><Option>-recomp</Option></Term>
+<IndexTerm><Primary><option>-recomp</option> option</Primary></IndexTerm>
+<ListItem>
+<Para>
+(On by default) Turn on recompilation checking.  This will stop
+compilation early, leaving an existing <filename>.o</filename> file in
+place, if it can be determined that the module does not need to be
 recompiled.
 </Para>
+</ListItem>
+</VarListEntry>
+<VarListEntry>
+<Term><Option>-no-recomp</Option></Term>
+<IndexTerm><Primary><option>-recomp</option> option</Primary></IndexTerm>
+<ListItem>
+<Para>
+Turn off recompilation checking.
+</Para>
+</ListItem>
+</VarListEntry>
+</VariableList>
+</Para>
+
+<Para>
+In the olden days, GHC compared the newly-generated
+<Filename>.hi</Filename> file with the previous version; if they were
+identical, it left the old one alone and didn't change its
+modification date.  In consequence, importers of a module with an
+unchanged output <Filename>.hi</Filename> file were not recompiled.
+</Para>
 
 <Para>
-This doesn't work any more.  In our earlier example, module <Literal>C</Literal> does
-not import module <Literal>A</Literal> directly, yet changes to <Filename>A.hi</Filename> should force a
-recompilation of <Literal>C</Literal>.  And some changes to <Literal>A</Literal> (changing the
-definition of a function that appears in an inlining of a function
-exported by <Literal>B</Literal>, say) may conceivably not change <Filename>B.hi</Filename> one jot.  So
+This doesn't work any more.  In our earlier example, module
+<Literal>C</Literal> does not import module <Literal>A</Literal>
+directly, yet changes to <Filename>A.hi</Filename> should force a
+recompilation of <Literal>C</Literal>.  And some changes to
+<Literal>A</Literal> (changing the definition of a function that
+appears in an inlining of a function exported by <Literal>B</Literal>,
+say) may conceivably not change <Filename>B.hi</Filename> one jot.  So
 now&hellip;
 </Para>
 
@@ -951,34 +978,48 @@ GHC keeps a version number on each interface file, and on each type
 signature within the interface file.  It also keeps in every interface
 file a list of the version numbers of everything it used when it last
 compiled the file.  If the source file's modification date is earlier
-than the <Filename>.o</Filename> file's date (i.e. the source hasn't changed since the
-file was last compiled), GHC will be clever.  It compares the version
-numbers on the things it needs this time with the version numbers on
-the things it needed last time (gleaned from the interface file of the
-module being compiled); if they are all the same it stops compiling
-rather early in the process saying &ldquo;Compilation IS NOT required&rdquo;.
-What a beautiful sight!
-</Para>
-
-<Para>
-GHC <Emphasis>only</Emphasis> keeps detailed dependency information for &ldquo;user&rdquo; modules,
-not for &ldquo;library&rdquo; modules.  It distinguishes the two by a hack: a module
-whose <Filename>.hi</Filename> file has an absolute path name is considered a library module,
-while a relative path name indicates a user module.  So if you have a
-multi-directory application, use <Emphasis>relative</Emphasis> path names in your
-<Option>-i</Option> path, to force GHC to record detailed dependency information.
-Use absolute path names only for directories containing slowly-changing
+than the <Filename>.o</Filename> file's date (i.e. the source hasn't
+changed since the file was last compiled), and the
+<option>-recomp</option> is given on the command line, GHC will be
+clever.  It compares the version numbers on the things it needs this
+time with the version numbers on the things it needed last time
+(gleaned from the interface file of the module being compiled); if
+they are all the same it stops compiling rather early in the process
+saying &ldquo;Compilation IS NOT required&rdquo;.  What a beautiful
+sight!
+</Para>
+
+<Para>
+GHC <Emphasis>only</Emphasis> keeps detailed dependency information
+for &ldquo;user&rdquo; modules, not for &ldquo;Prelude&rdquo; modules.
+It distinguishes Prelude modules because their names start with
+"Prel", so don't start your modules that way!
+
+<!--       April 2000: hack disabled.  Now we use a different hack!
+
+It distinguishes the two by a hack: a module whose
+<Filename>.hi</Filename> file has an absolute path name is considered
+a library module, while a relative path name indicates a user module.
+So if you have a multi-directory application, use
+<Emphasis>relative</Emphasis> path names in your <Option>-i</Option>
+path, to force GHC to record detailed dependency information.  Use
+absolute path names only for directories containing slowly-changing
 library modules.
 </Para>
 
 <Para>
-A path is considered &ldquo;absolute&rdquo; if it starts with &ldquo;<Filename>/</Filename>&rdquo;, or
-&ldquo;<Filename>A:/</Filename>&rdquo;, or &ldquo;<Filename>A:\</Filename>&rdquo; (or &ldquo;<Filename>B:/</Filename>&rdquo;, &ldquo;<Filename>B:\</Filename>&rdquo; etc).
+A path is considered &ldquo;absolute&rdquo; if it starts with
+&ldquo;<Filename>/</Filename>&rdquo;, or
+&ldquo;<Filename>A:/</Filename>&rdquo;, or
+&ldquo;<Filename>A:\</Filename>&rdquo; (or
+&ldquo;<Filename>B:/</Filename>&rdquo;,
+&ldquo;<Filename>B:\</Filename>&rdquo; etc).
 </Para>
+-->
 
 <Para>
 Patrick Sansom had a workshop paper about how all this is done (though
-the details have changed quite a bit). <ULink URL="mailto:sansom@dcs.gla.ac.uk">Ask him</ULink>) if you want a copy.
+the details have changed quite a bit). <ULink URL="mailto:sansom@dcs.gla.ac.uk">Ask him</ULink> if you want a copy.
 </Para>
 
 </Sect2>
@@ -1323,9 +1364,9 @@ safely (see <XRef LinkEnd="recomp">).
 
 <VarListEntry>
 <Term>No <Option>-O*</Option>-type option specified:</Term>
+<IndexTerm><Primary>-O* not specified</Primary></IndexTerm>
 <ListItem>
 <Para>
-<IndexTerm><Primary>-O* not specified</Primary></IndexTerm>
 This is taken to mean: &ldquo;Please compile quickly; I'm not over-bothered
 about compiled-code quality.&rdquo;  So, for example: <Command>ghc -c Foo.hs</Command>
 </Para>
@@ -1333,22 +1374,22 @@ about compiled-code quality.&rdquo;  So, for example: <Command>ghc -c Foo.hs</Co
 </VarListEntry>
 <VarListEntry>
 <Term><Option>-O</Option> or <Option>-O1</Option>:</Term>
-<ListItem>
-<Para>
 <IndexTerm><Primary>-O option</Primary></IndexTerm>
 <IndexTerm><Primary>-O1 option</Primary></IndexTerm>
-<IndexTerm><Primary>optimise normally</Primary></IndexTerm>
-Means: &ldquo;Generate good-quality code without taking too long about it.&rdquo;
-Thus, for example: <Command>ghc -c -O Main.lhs</Command>
+<IndexTerm><Primary>optimise</Primary><secondary>normally</secondary></IndexTerm>
+<ListItem>
+<Para>
+Means: &ldquo;Generate good-quality code without taking too long about
+it.&rdquo; Thus, for example: <Command>ghc -c -O Main.lhs</Command>
 </Para>
 </ListItem>
 </VarListEntry>
 <VarListEntry>
 <Term><Option>-O2</Option>:</Term>
+<IndexTerm><Primary>-O2 option</Primary></IndexTerm>
+<IndexTerm><Primary>optimise</Primary><secondary>aggressively</secondary></IndexTerm>
 <ListItem>
 <Para>
-<IndexTerm><Primary>-O2 option</Primary></IndexTerm>
-<IndexTerm><Primary>optimise aggressively</Primary></IndexTerm>
 Means: &ldquo;Apply every non-dangerous optimisation, even if it means
 significantly longer compile times.&rdquo;
 </Para>
@@ -1367,12 +1408,9 @@ better code than <Option>-O</Option>.
 </VarListEntry>
 <VarListEntry>
 <Term><Option>-O2-for-C</Option>:</Term>
-<ListItem>
-<Para>
 <IndexTerm><Primary>-O2-for-C option</Primary></IndexTerm>
 <IndexTerm><Primary>gcc, invoking with -O2</Primary></IndexTerm>
-</Para>
-
+<ListItem>
 <Para>
 Says to run GCC with <Option>-O2</Option>, which may be worth a few percent in
 execution speed.  Don't forget <Option>-fvia-C</Option>, lest you use the native-code
@@ -1382,35 +1420,33 @@ generator and bypass GCC altogether!
 </VarListEntry>
 <VarListEntry>
 <Term><Option>-Onot</Option>:</Term>
-<ListItem>
-<Para>
 <IndexTerm><Primary>-Onot option</Primary></IndexTerm>
 <IndexTerm><Primary>optimising, reset</Primary></IndexTerm>
-</Para>
-
+<ListItem>
 <Para>
-This option will make GHC &ldquo;forget&rdquo; any <Option>-O</Option>ish options it has seen so
-far.  Sometimes useful; for example: <Command>make all EXTRA&lowbar;HC&lowbar;OPTS=-Onot</Command>.
+This option will make GHC &ldquo;forget&rdquo; any
+<Option>-O</Option>ish options it has seen so far.  Sometimes useful;
+for example: <Command>make all
+EXTRA&lowbar;HC&lowbar;OPTS=-Onot</Command>.
 </Para>
 </ListItem>
 </VarListEntry>
 <VarListEntry>
 <Term><Option>-Ofile &lt;file&gt;</Option>:</Term>
-<ListItem>
-<Para>
 <IndexTerm><Primary>-Ofile &lt;file&gt; option</Primary></IndexTerm>
 <IndexTerm><Primary>optimising, customised</Primary></IndexTerm>
-</Para>
-
+<ListItem>
 <Para>
-For those who need <Emphasis>absolute</Emphasis> control over <Emphasis>exactly</Emphasis>
-what options are used (e.g., compiler writers, sometimes :-), a list
-of options can be put in a file and then slurped in with <Option>-Ofile</Option>.
+For those who need <Emphasis>absolute</Emphasis> control over
+<Emphasis>exactly</Emphasis> what options are used (e.g., compiler
+writers, sometimes :-), a list of options can be put in a file and
+then slurped in with <Option>-Ofile</Option>.
 </Para>
 
 <Para>
-In that file, comments are of the <Literal>&num;</Literal>-to-end-of-line variety; blank
-lines and most whitespace is ignored.
+In that file, comments are of the
+<Literal>&num;</Literal>-to-end-of-line variety; blank lines and most
+whitespace is ignored.
 </Para>
 
 <Para>
@@ -2198,17 +2234,20 @@ options the driver passes through to the linker.
 GHC (as of version 4.00) supports Concurrent Haskell by default,
 without requiring a special option or libraries compiled in a certain
 way.  To get access to the support libraries for Concurrent Haskell
-(i.e. <Literal>Concurrent</Literal> and friends), use the <Option>-syslib concurrent</Option> option.
+(i.e. <Literal>Concurrent</Literal> and friends), use the
+<Option>-syslib concurrent</Option> option.
 </Para>
 
 <Para>
 Three RTS options are provided for modifying the behaviour of the
-threaded runtime system.  See the descriptions of <Option>-C[&lt;us&gt;]</Option>, <Option>-q</Option>,
-and <Option>-t&lt;num&gt;</Option> in <XRef LinkEnd="parallel-rts-opts">.
+threaded runtime system.  See the descriptions of
+<Option>-C[&lt;us&gt;]</Option>, <Option>-q</Option>, and
+<Option>-t&lt;num&gt;</Option> in <XRef LinkEnd="parallel-rts-opts">.
 </Para>
 
 <Para>
-Concurrent Haskell is described in more detail in <XRef LinkEnd="concurrent-and-parallel">.
+Concurrent Haskell is described in more detail in <XRef
+LinkEnd="sec-Concurrent">.
 </Para>
 
 </Sect1>
@@ -2227,16 +2266,19 @@ Concurrent Haskell is described in more detail in <XRef LinkEnd="concurrent-and-
 
 <Para>
 To compile a Haskell program for parallel execution under PVM, use the
-<Option>-parallel</Option> option,<IndexTerm><Primary>-parallel option</Primary></IndexTerm> both when compiling
-<Emphasis>and linking</Emphasis>.  You will probably want to <Literal>import Parallel</Literal>
-into your Haskell modules.
+<Option>-parallel</Option> option,<IndexTerm><Primary>-parallel
+option</Primary></IndexTerm> both when compiling <Emphasis>and
+linking</Emphasis>.  You will probably want to <Literal>import
+Parallel</Literal> into your Haskell modules.
 </Para>
 
 <Para>
-To run your parallel program, once PVM is going, just invoke it &ldquo;as
-normal&rdquo;.  The main extra RTS option is <Option>-N&lt;n&gt;</Option>, to say how many
-PVM &ldquo;processors&rdquo; your program to run on.  (For more details of
-all relevant RTS options, please see <XRef LinkEnd="parallel-rts-opts">.)
+To run your parallel program, once PVM is going, just invoke it
+&ldquo;as normal&rdquo;.  The main extra RTS option is
+<Option>-N&lt;n&gt;</Option>, to say how many PVM
+&ldquo;processors&rdquo; your program to run on.  (For more details of
+all relevant RTS options, please see <XRef
+LinkEnd="parallel-rts-opts">.)
 </Para>
 
 <Para>