1 <Chapter id="using-GHC">
6 <IndexTerm><Primary>GHC, using</Primary></IndexTerm>
7 <IndexTerm><Primary>using GHC</Primary></IndexTerm>
8 GHC is a command-line compiler: in order to compile a Haskell program,
9 GHC must be invoked on the source file(s) by typing a command to the
10 shell. The steps involved in compiling a program can be automated
11 using the <Command>make</Command> tool (this is especially useful if the program
12 consists of multiple source files which depend on each other). This
13 section describes how to use GHC from the command-line.
16 <Sect1 id="command-line-structure">
17 <Title>Overall command-line structure
21 <IndexTerm><Primary>structure, command-line</Primary></IndexTerm>
22 <IndexTerm><Primary>command-line structure</Primary></IndexTerm>
26 An invocation of GHC takes the following form:
38 Command-line arguments are either options or file names.
42 Command-line options begin with <Literal>-</Literal>. They may <Emphasis>not</Emphasis> be
43 grouped: <Option>-vO</Option> is different from <Option>-v -O</Option>. Options need not
44 precede filenames: e.g., <Command>ghc *.o -o foo</Command>. All options are
45 processed and then applied to all files; you cannot, for example, invoke
46 <Command>ghc -c -O1 Foo.hs -O2 Bar.hs</Command> to apply different optimisation
47 levels to the files <Filename>Foo.hs</Filename> and <Filename>Bar.hs</Filename>. For conflicting
48 options, e.g., <Option>-c -S</Option>, we reserve the right to do anything we
49 want. (Usually, the last one applies.)
54 <Sect1 id="file-suffixes">
55 <Title>Meaningful file suffixes
59 <IndexTerm><Primary>suffixes, file</Primary></IndexTerm>
60 <IndexTerm><Primary>file suffixes for GHC</Primary></IndexTerm>
64 File names with “meaningful” suffixes (e.g., <Filename>.lhs</Filename> or <Filename>.o</Filename>)
65 cause the “right thing” to happen to those files.
72 <Term><Filename>.lhs</Filename>:</Term>
75 <IndexTerm><Primary>lhs suffix</Primary></IndexTerm>
76 A “literate Haskell” module.
81 <Term><Filename>.hs</Filename>:</Term>
84 A not-so-literate Haskell module.
89 <Term><Filename>.hi</Filename>:</Term>
92 A Haskell interface file, probably compiler-generated.
97 <Term><Filename>.hc</Filename>:</Term>
100 Intermediate C file produced by the Haskell compiler.
105 <Term><Filename>.c</Filename>:</Term>
108 A C file not produced by the Haskell compiler.
113 <Term><Filename>.s</Filename>:</Term>
116 An assembly-language source file, usually
117 produced by the compiler.
122 <Term><Filename>.o</Filename>:</Term>
125 An object file, produced by an assembler.
133 Files with other suffixes (or without suffixes) are passed straight
139 <Sect1 id="options-help">
140 <Title>Help and verbosity options
144 <IndexTerm><Primary>help options (GHC)</Primary></IndexTerm>
145 <IndexTerm><Primary>verbose option (GHC)</Primary></IndexTerm>
149 A good option to start with is the <Option>-help</Option> (or <Option>-?</Option>) option.
150 <IndexTerm><Primary>-help option</Primary></IndexTerm>
151 <IndexTerm><Primary>-? option</Primary></IndexTerm>
152 GHC spews a long message to standard output and then exits.
156 The <Option>-v</Option><IndexTerm><Primary>-v option</Primary></IndexTerm> option makes GHC <Emphasis>verbose</Emphasis>: it
157 reports its version number and shows (on stderr) exactly how it invokes each
158 phase of the compilation system. Moreover, it passes
159 the <Option>-v</Option> flag to most phases; each reports
160 its version number (and possibly some other information).
164 Please, oh please, use the <Option>-v</Option> option when reporting bugs!
165 Knowing that you ran the right bits in the right order is always the
166 first thing we want to verify.
170 If you're just interested in the compiler version number, the
171 <Option>--version</Option><IndexTerm><Primary>--version option</Primary></IndexTerm> option prints out a
172 one-line string containing the requested info.
177 <Sect1 id="options-order">
178 <Title>Running the right phases in the right order
182 <IndexTerm><Primary>order of passes in GHC</Primary></IndexTerm>
183 <IndexTerm><Primary>pass ordering in GHC</Primary></IndexTerm>
184 The basic task of the <Command>ghc</Command> driver is to run each input file
185 through the right phases (compiling, linking, etc.).
189 The first phase to run is determined by the input-file suffix, and the
190 last phase is determined by a flag. If no relevant flag is present,
191 then go all the way through linking. This table summarises:
197 <ColSpec Align="Left">
198 <ColSpec Align="Left">
199 <ColSpec Align="Left">
200 <ColSpec Align="Left">
204 <Entry>Phase of the compilation system</Entry>
205 <Entry>Suffix saying “start here”</Entry>
206 <Entry>Flag saying “stop after”</Entry>
207 <Entry>(suffix of) output file</Entry>
212 literate pre-processor </Entry>
213 <Entry> .lhs </Entry>
219 C pre-processor (opt.) </Entry>
226 Haskell compiler </Entry>
228 <Entry> -C, -S </Entry>
229 <Entry> .hc, .s </Entry>
233 C compiler (opt.) </Entry>
234 <Entry> .hc or .c </Entry>
248 <Entry> other </Entry>
250 <Entry> a.out </Entry>
256 <IndexTerm><Primary>-C option</Primary></IndexTerm>
257 <IndexTerm><Primary>-S option</Primary></IndexTerm>
258 <IndexTerm><Primary>-c option</Primary></IndexTerm>
262 Thus, a common invocation would be: <Command>ghc -c Foo.hs</Command>
266 Note: What the Haskell compiler proper produces depends on whether a
267 native-code generator is used (producing assembly language) or not
272 The option <Option>-cpp</Option><IndexTerm><Primary>-cpp option</Primary></IndexTerm> must be given for the C
273 pre-processor phase to be run, that is, the pre-processor will be run
274 over your Haskell source file before continuing.
278 The option <Option>-E</Option><IndexTerm><Primary>-E option</Primary></IndexTerm> runs just the pre-processing
279 passes of the compiler, outputting the result on stdout before
280 stopping. If used in conjunction with -cpp, the output is the
281 code blocks of the original (literal) source after having put it
282 through the grinder that is the C pre-processor. Sans <Option>-cpp</Option>, the
283 output is the de-litted version of the original source.
287 The option <Option>-optcpp-E</Option><IndexTerm><Primary>-optcpp-E option</Primary></IndexTerm> runs just the
288 pre-processing stage of the C-compiling phase, sending the result to
289 stdout. (For debugging or obfuscation contests, usually.)
294 <Sect1 id="options-output">
295 <Title>Re-directing the compilation output(s)
299 <IndexTerm><Primary>output-directing options</Primary></IndexTerm>
303 GHC's compiled output normally goes into a <Filename>.hc</Filename>, <Filename>.o</Filename>, etc., file,
304 depending on the last-run compilation phase. The option <Option>-o
305 foo</Option><IndexTerm><Primary>-o option</Primary></IndexTerm> re-directs the output of that last-run
306 phase to file <Filename>foo</Filename>.
310 Note: this “feature” can be counterintuitive:
311 <Command>ghc -C -o foo.o foo.hs</Command> will put the intermediate C code in the
312 file <Filename>foo.o</Filename>, name notwithstanding!
316 EXOTICA: But the <Option>-o</Option> option isn't of much use if you have
317 <Emphasis>several</Emphasis> input files… Non-interface output files are
318 normally put in the same directory as their corresponding input file
319 came from. You may specify that they be put in another directory
320 using the <Option>-odir <dir></Option><IndexTerm><Primary>-odir <dir> option</Primary></IndexTerm> (the
321 “Oh, dear” option). For example:
327 % ghc -c parse/Foo.hs parse/Bar.hs gurgle/Bumble.hs -odir `arch`
333 The output files, <Filename>Foo.o</Filename>, <Filename>Bar.o</Filename>, and <Filename>Bumble.o</Filename> would be
334 put into a subdirectory named after the architecture of the executing
335 machine (<Filename>sun4</Filename>, <Filename>mips</Filename>, etc). The directory must already
336 exist; it won't be created.
340 Note that the <Option>-odir</Option> option does <Emphasis>not</Emphasis> affect where the
341 interface files are put. In the above example, they would still be
342 put in <Filename>parse/Foo.hi</Filename>, <Filename>parse/Bar.hi</Filename>, and <Filename>gurgle/Bumble.hi</Filename>.
346 MORE EXOTICA: The <Option>-osuf <suffix></Option><IndexTerm><Primary>-osuf <suffix>
347 option</Primary></IndexTerm> will change the <Filename>.o</Filename> file suffix for object files to
348 whatever you specify. (We use this in compiling the prelude.).
349 Similarly, the <Option>-hisuf <suffix></Option><IndexTerm><Primary>-hisuf <suffix>
350 option</Primary></IndexTerm> will change the <Filename>.hi</Filename> file suffix for non-system
351 interface files (see <XRef LinkEnd="hi-options">).
355 The <Option>-hisuf</Option>/<Option>-osuf</Option> game is useful if you want to compile a program
356 with both GHC and HBC (say) in the same directory. Let HBC use the
357 standard <Filename>.hi</Filename>/<Filename>.o</Filename> suffixes; add <Option>-hisuf g_hi -osuf g_o</Option> to your
358 <Command>make</Command> rule for GHC compiling…
362 FURTHER EXOTICA: If you are doing a normal <Filename>.hs</Filename>-to-<Filename>.o</Filename> compilation
363 but would like to hang onto the intermediate <Filename>.hc</Filename> C file, just
364 throw in a <Option>-keep-hc-file-too</Option> option<IndexTerm><Primary>-keep-hc-file-too option</Primary></IndexTerm>.
365 If you would like to look at the assembler output, toss in a
366 <Option>-keep-s-file-too</Option>,<IndexTerm><Primary>-keep-s-file-too option</Primary></IndexTerm> too.
369 <Sect2 id="saving-ghc-stderr">
370 <Title>Saving GHC's standard error output
374 <IndexTerm><Primary>standard error, saving</Primary></IndexTerm>
378 Sometimes, you may cause GHC to be rather chatty on standard error;
379 with <Option>-v</Option>, for example. You can instruct GHC to <Emphasis>append</Emphasis> this
380 output to a particular log file with a <Option>-odump <blah></Option><IndexTerm><Primary>-odump
381 <blah> option</Primary></IndexTerm> option.
386 <Sect2 id="temp-files">
387 <Title>Redirecting temporary files
391 <IndexTerm><Primary>temporary files, redirecting</Primary></IndexTerm>
395 If you have trouble because of running out of space in <Filename>/tmp</Filename> (or
396 wherever your installation thinks temporary files should go), you may
397 use the <Option>-tmpdir <dir></Option><IndexTerm><Primary>-tmpdir <dir> option</Primary></IndexTerm> option
398 to specify an alternate directory. For example, <Option>-tmpdir .</Option> says to
399 put temporary files in the current working directory.
403 Alternatively, use your <Constant>TMPDIR</Constant> environment variable.<IndexTerm><Primary>TMPDIR
404 environment variable</Primary></IndexTerm> Set it to the name of the directory where
405 temporary files should be put. GCC and other programs will honour the
406 <Constant>TMPDIR</Constant> variable as well.
410 Even better idea: Set the <Constant>TMPDIR</Constant> variable when building GHC, and
411 never worry about <Constant>TMPDIR</Constant> again. (see the build documentation).
418 <Sect1 id="options-sanity">
419 <Title>Warnings and sanity-checking
423 <IndexTerm><Primary>sanity-checking options</Primary></IndexTerm>
424 <IndexTerm><Primary>warnings</Primary></IndexTerm>
425 GHC has a number of options that select which types of non-fatal error
426 messages, otherwise known as warnings, can be generated during
427 compilation. By default, you get a standard set of warnings which are
428 generally likely to indicate bugs in your program. These are:
429 <Option>-fwarn-overlpapping-patterns</Option>, <Option>-fwarn-duplicate-exports</Option>, and
430 <Option>-fwarn-missing-methods</Option>. The following flags are simple ways to
431 select standard “packages” of warnings:
438 <Term><Option>-Wnot</Option>:</Term>
441 <IndexTerm><Primary>-Wnot option</Primary></IndexTerm>
442 Turns off all warnings, including the standard ones.
448 <Term><Option>-w</Option>:</Term>
451 <IndexTerm><Primary>-w option</Primary></IndexTerm>
452 Synonym for <Option>-Wnot</Option>.
458 <Term><Option>-W</Option>:</Term>
461 <IndexTerm><Primary>-W option</Primary></IndexTerm>
462 Provides the standard warnings plus <Option>-fwarn-incomplete-patterns</Option>,
463 <Option>-fwarn-unused-imports</Option> and <Option>-fwarn-unused-binds</Option>.
469 <Term><Option>-Wall</Option>:</Term>
472 <IndexTerm><Primary>-Wall option</Primary></IndexTerm>
473 Turns on all warning options.
482 The full set of warning options is described below. To turn off any
483 warning, simply give the corresponding <Option>-fno-warn-...</Option> option on
491 <Term><Option>-fwarn-name-shadowing</Option>:</Term>
494 <IndexTerm><Primary>-fwarn-name-shadowing option</Primary></IndexTerm>
495 <IndexTerm><Primary>shadowing, warning</Primary></IndexTerm>This option causes a warning to be emitted whenever an inner-scope
496 value has the same name as an outer-scope value, i.e. the inner value
497 shadows the outer one. This can catch typographical errors that turn
498 into hard-to-find bugs, e.g., in the inadvertent cyclic definition
499 <Literal>let x = ... x ... in</Literal>.
503 Consequently, this option does <Emphasis>not</Emphasis> allow cyclic recursive
510 <Term><Option>-fwarn-overlapping-patterns</Option>:</Term>
513 <IndexTerm><Primary>-fwarn-overlapping-patterns option</Primary></IndexTerm>
514 <IndexTerm><Primary>overlapping patterns, warning</Primary></IndexTerm>
515 <IndexTerm><Primary>patterns, overlapping</Primary></IndexTerm>
516 By default, the compiler will warn you if a set of patterns are
522 f :: String -> Int
530 where the last pattern match in <Function>f</Function> won't ever be reached, as the
531 second pattern overlaps it. More often than not, redundant patterns
532 is a programmer mistake/error, so this option is enabled by default.
538 <Term><Option>-fwarn-incomplete-patterns</Option>:</Term>
541 <IndexTerm><Primary>-fwarn-incomplete-patterns option</Primary></IndexTerm>
542 <IndexTerm><Primary>incomplete patterns, warning</Primary></IndexTerm>
543 <IndexTerm><Primary>patterns, incomplete</Primary></IndexTerm>
544 Similarly for incomplete patterns, the function <Function>g</Function> below will fail
545 when applied to non-empty lists, so the compiler will emit a warning
546 about this when <Option>-fwarn-incomplete-patterns</Option> is enabled.
556 This option isn't enabled be default because it can be a bit noisy,
557 and it doesn't always indicate a bug in the program. However, it's
558 generally considered good practice to cover all the cases in your
565 <Term><Option>-fwarn-missing-methods</Option>:</Term>
568 <IndexTerm><Primary>-fwarn-missing-methods option</Primary></IndexTerm>
569 <IndexTerm><Primary>missing methods, warning</Primary></IndexTerm>
570 <IndexTerm><Primary>methods, missing</Primary></IndexTerm>
571 This option is on by default, and warns you whenever an instance
572 declaration is missing one or more methods, and the corresponding
573 class declaration has no default declaration for them.
579 <Term><Option>-fwarn-missing-fields</Option>:</Term>
582 <IndexTerm><Primary>-fwarn-missing-fields option</Primary></IndexTerm>
583 <IndexTerm><Primary>missing fields, warning</Primary></IndexTerm>
584 <IndexTerm><Primary>fields, missing</Primary></IndexTerm>
585 This option is on by default, and warns you whenever the construction
586 of a labelled field constructor isn't complete, missing initializers
587 for one or more fields. While not an error (the missing fields are
588 initialised with bottoms), it is often an indication of a programmer
595 <Term><Option>-fwarn-unused-imports</Option>:</Term>
598 <IndexTerm><Primary>-fwarn-unused-imports option</Primary></IndexTerm>
599 <IndexTerm><Primary>unused imports, warning</Primary></IndexTerm>
600 <IndexTerm><Primary>imports, unused</Primary></IndexTerm>
601 Report any objects that are explicitly imported but never used.
607 <Term><Option>-fwarn-unused-binds</Option>:</Term>
610 <IndexTerm><Primary>-fwarn-unused-binds option</Primary></IndexTerm>
611 <IndexTerm><Primary>unused binds, warning</Primary></IndexTerm>
612 <IndexTerm><Primary>binds, unused</Primary></IndexTerm>
613 Report any function definitions (and local bindings) which are unused.
614 For top-level functions, the warning is only given if the binding is
620 <Term><Option>-fwarn-unused-matches</Option>:</Term>
623 <IndexTerm><Primary>-fwarn-unused-matches option</Primary></IndexTerm>
624 <IndexTerm><Primary>unused matches, warning</Primary></IndexTerm>
625 <IndexTerm><Primary>matches, unused</Primary></IndexTerm>
626 Report all unused variables which arise from pattern matches,
627 including patterns consisting of a single variable. For instance <Literal>f x
628 y = []</Literal> would report <VarName>x</VarName> and <VarName>y</VarName> as unused. To eliminate the warning,
629 all unused variables can be replaced with wildcards.
635 <Term><Option>-fwarn-duplicate-exports</Option>:</Term>
638 <IndexTerm><Primary>-fwarn-duplicate-exports option</Primary></IndexTerm>
639 <IndexTerm><Primary>duplicate exports, warning</Primary></IndexTerm>
640 <IndexTerm><Primary>export lists, duplicates</Primary></IndexTerm>
641 Have the compiler warn about duplicate entries in export lists. This
642 is useful information if you maintain large export lists, and want to
643 avoid the continued export of a definition after you've deleted (one)
644 mention of it in the export list.
648 This option is on by default.
654 <Term><Option>-fwarn-type-defaults</Option>:</Term>
657 <IndexTerm><Primary>-fwarn-type-defaults option</Primary></IndexTerm>
658 <IndexTerm><Primary>defaulting mechanism, warning</Primary></IndexTerm>
659 Have the compiler warn/inform you where in your source the Haskell
660 defaulting mechanism for numeric types kicks in. This is useful
661 information when converting code from a context that assumed one
662 default into one with another, e.g., the `default default' for Haskell
663 1.4 caused the otherwise unconstrained value <Constant>1</Constant> to be given
664 the type <Literal>Int</Literal>, whereas Haskell 98 defaults it to
665 <Literal>Integer</Literal>. This may lead to differences in performance and
666 behaviour, hence the usefulness of being non-silent about this.
670 This warning is off by default.
676 <Term><Option>-fwarn-missing-signatures</Option>:</Term>
679 <IndexTerm><Primary>-fwarn-missing-signatures option</Primary></IndexTerm>
680 <IndexTerm><Primary>type signatures, missing</Primary></IndexTerm>
681 If you would like GHC to check that every top-level function/value has
682 a type signature, use the <Option>-fwarn-missing-signatures</Option> option. This
683 option is off by default.
691 If you're feeling really paranoid, the <Option>-dcore-lint</Option>
692 option<IndexTerm><Primary>-dcore-lint option</Primary></IndexTerm> is a good choice. It turns on
693 heavyweight intra-pass sanity-checking within GHC. (It checks GHC's
699 <Sect1 id="separate-compilation">
700 <Title>Separate compilation
704 <IndexTerm><Primary>separate compilation</Primary></IndexTerm>
705 <IndexTerm><Primary>recompilation checker</Primary></IndexTerm>
706 <IndexTerm><Primary>make and recompilation</Primary></IndexTerm>
707 This section describes how GHC supports separate compilation.
710 <Sect2 id="hi-files">
711 <Title>Interface files
715 <IndexTerm><Primary>interface files</Primary></IndexTerm>
716 <IndexTerm><Primary>.hi files</Primary></IndexTerm>
720 When GHC compiles a source file <Filename>F</Filename> which contains a module <Literal>A</Literal>, say,
721 it generates an object <Filename>F.o</Filename>, <Emphasis>and</Emphasis> a companion <Emphasis>interface
722 file</Emphasis> <Filename>A.hi</Filename>. The interface file is not intended for human
723 consumption, as you'll see if you take a look at one. It's merely
724 there to help the compiler compile other modules in the same program.
728 NOTE: Having the name of the interface file follow the module name and
729 not the file name, means that working with tools such as <Command>make</Command>
730 become harder. <Command>make</Command> implicitly assumes that any output files
731 produced by processing a translation unit will have file names that
732 can be derived from the file name of the translation unit. For
733 instance, pattern rules becomes unusable. For this reason, we
734 recommend you stick to using the same file name as the module name.
738 The interface file for <Literal>A</Literal> contains information needed by the compiler
739 when it compiles any module <Literal>B</Literal> that imports <Literal>A</Literal>, whether directly or
740 indirectly. When compiling <Literal>B</Literal>, GHC will read <Filename>A.hi</Filename> to find the
741 details that it needs to know about things defined in <Literal>A</Literal>.
745 Furthermore, when compiling module <Literal>C</Literal> which imports <Literal>B</Literal>, GHC may
746 decide that it needs to know something about <Literal>A</Literal>—for example, <Literal>B</Literal>
747 might export a function that involves a type defined in <Literal>A</Literal>. In this
748 case, GHC will go and read <Command>A.hi</Command> even though <Literal>C</Literal> does not explicitly
749 import <Literal>A</Literal> at all.
753 The interface file may contain all sorts of things that aren't
754 explicitly exported from <Literal>A</Literal> by the programmer. For example, even
755 though a data type is exported abstractly, <Filename>A.hi</Filename> will contain the
756 full data type definition. For small function definitions, <Filename>A.hi</Filename>
757 will contain the complete definition of the function. For bigger
758 functions, <Filename>A.hi</Filename> will contain strictness information about the
759 function. And so on. GHC puts much more information into <Filename>.hi</Filename> files
760 when optimisation is turned on with the <Option>-O</Option> flag. Without <Option>-O</Option> it
761 puts in just the minimum; with <Option>-O</Option> it lobs in a whole pile of stuff.
762 <IndexTerm><Primary>optimsation, effect on .hi files</Primary></IndexTerm>
766 <Filename>A.hi</Filename> should really be thought of as a compiler-readable version of
767 <Filename>A.o</Filename>. If you use a <Filename>.hi</Filename> file that wasn't generated by the same
768 compilation run that generates the <Filename>.o</Filename> file the compiler may assume
769 all sorts of incorrect things about <Literal>A</Literal>, resulting in core dumps and
770 other unpleasant happenings.
775 <Sect2 id="options-finding-imports">
776 <Title>Finding interface files
780 <IndexTerm><Primary>interface files, finding them</Primary></IndexTerm>
781 <IndexTerm><Primary>finding interface files</Primary></IndexTerm>
785 In your program, you import a module <Literal>Foo</Literal> by saying
786 <Literal>import Foo</Literal>. GHC goes looking for an interface file, <Filename>Foo.hi</Filename>.
787 It has a builtin list of directories (notably including <Filename>.</Filename>) where
795 <Term><Option>-i<dirs></Option></Term>
798 <IndexTerm><Primary>-i<dirs> option</Primary></IndexTerm>This flag
799 prepends a colon-separated list of <Filename>dirs</Filename> to the “import
800 directories” list.
801 See also <XRef LinkEnd="recomp"> for the significance of using
802 relative and absolute pathnames in the <Option>-i</Option> list.
808 <Term><Option>-i</Option></Term>
811 resets the “import directories” list back to nothing.
817 <Term><Option>-fno-implicit-prelude</Option></Term>
820 <IndexTerm><Primary>-fno-implicit-prelude option</Primary></IndexTerm>
821 GHC normally imports <Filename>Prelude.hi</Filename> files for you. If you'd rather it
822 didn't, then give it a <Option>-fno-implicit-prelude</Option> option. You are
823 unlikely to get very far without a Prelude, but, hey, it's a free
830 <Term><Option>-syslib <lib></Option></Term>
833 <IndexTerm><Primary>-syslib <lib> option</Primary></IndexTerm>
834 If you are using a system-supplied non-Prelude library (e.g., the
835 POSIX library), just use a <Option>-syslib posix</Option> option (for
836 example). The right interface files should then be available. The
837 accompanying HsLibs document lists the libraries available by this
844 <Term><Option>-I<dir></Option></Term>
847 <IndexTerm><Primary>-I<dir> option</Primary></IndexTerm>
848 Once a Haskell module has been compiled to C (<Filename>.hc</Filename> file), you may
849 wish to specify where GHC tells the C compiler to look for <Filename>.h</Filename> files.
850 (Or, if you are using the <Option>-cpp</Option> option<IndexTerm><Primary>-cpp option</Primary></IndexTerm>, where
851 it tells the C pre-processor to look…) For this purpose, use a <Option>-I</Option>
852 option in the usual C-ish way.
862 <Sect2 id="hi-options">
863 <Title>Other options related to interface files
867 <IndexTerm><Primary>interface files, options</Primary></IndexTerm>
868 The interface output may be directed to another file
869 <Filename>bar2/Wurble.iface</Filename> with the option <Option>-ohi bar2/Wurble.iface</Option><IndexTerm><Primary>-ohi
870 <file> option</Primary></IndexTerm> (not recommended).
874 To avoid generating an interface file at all, use a <Option>-nohi</Option>
875 option.<IndexTerm><Primary>-nohi option</Primary></IndexTerm>
879 The compiler does not overwrite an existing <Filename>.hi</Filename> interface file if
880 the new one is byte-for-byte the same as the old one; this is friendly
881 to <Command>make</Command>. When an interface does change, it is often enlightening to
882 be informed. The <Option>-hi-diffs</Option><IndexTerm><Primary>-hi-diffs option</Primary></IndexTerm> option will
883 make GHC run <Command>diff</Command> on the old and new <Filename>.hi</Filename> files. You can also
884 record the difference in the interface file itself, the
885 <Option>-keep-hi-diffs</Option><IndexTerm><Primary>-keep-hi-diffs</Primary></IndexTerm> option takes care of that.
889 The <Filename>.hi</Filename> files from GHC contain “usage” information which changes
890 often and uninterestingly. If you really want to see these changes
891 reported, you need to use the
892 <Option>-hi-diffs-with-usages</Option><IndexTerm><Primary>-hi-diffs-with-usages option</Primary></IndexTerm>
897 Interface files are normally jammed full of compiler-produced
898 <Emphasis>pragmas</Emphasis>, which record arities, strictness info, etc. If you
899 think these pragmas are messing you up (or you are doing some kind of
900 weird experiment), you can tell GHC to ignore them with the
901 <Option>-fignore-interface-pragmas</Option><IndexTerm><Primary>-fignore-interface-pragmas
902 option</Primary></IndexTerm> option.
906 When compiling without optimisations on, the compiler is extra-careful
907 about not slurping in data constructors and instance declarations that
908 it will not need. If you believe it is getting it wrong and not
909 importing stuff which you think it should, this optimisation can be
910 turned off with <Option>-fno-prune-tydecls</Option> and <Option>-fno-prune-instdecls</Option>.
911 <IndexTerm><Primary>-fno-prune-tydecls option</Primary></IndexTerm><IndexTerm><Primary>-fno-prune-instdecls
912 option</Primary></IndexTerm>
916 See also <XRef LinkEnd="options-linker">, which describes how the linker finds standard
923 <Title>The recompilation checker
926 <IndexTerm><Primary>recompilation checker</Primary></IndexTerm>
931 <Term><Option>-recomp</Option></Term>
932 <IndexTerm><Primary><option>-recomp</option> option</Primary></IndexTerm>
935 (On by default) Turn on recompilation checking. This will stop
936 compilation early, leaving an existing <filename>.o</filename> file in
937 place, if it can be determined that the module does not need to be
943 <Term><Option>-no-recomp</Option></Term>
944 <IndexTerm><Primary><option>-recomp</option> option</Primary></IndexTerm>
947 Turn off recompilation checking.
955 In the olden days, GHC compared the newly-generated
956 <Filename>.hi</Filename> file with the previous version; if they were
957 identical, it left the old one alone and didn't change its
958 modification date. In consequence, importers of a module with an
959 unchanged output <Filename>.hi</Filename> file were not recompiled.
963 This doesn't work any more. In our earlier example, module
964 <Literal>C</Literal> does not import module <Literal>A</Literal>
965 directly, yet changes to <Filename>A.hi</Filename> should force a
966 recompilation of <Literal>C</Literal>. And some changes to
967 <Literal>A</Literal> (changing the definition of a function that
968 appears in an inlining of a function exported by <Literal>B</Literal>,
969 say) may conceivably not change <Filename>B.hi</Filename> one jot. So
974 GHC keeps a version number on each interface file, and on each type
975 signature within the interface file. It also keeps in every interface
976 file a list of the version numbers of everything it used when it last
977 compiled the file. If the source file's modification date is earlier
978 than the <Filename>.o</Filename> file's date (i.e. the source hasn't
979 changed since the file was last compiled), and the
980 <option>-recomp</option> is given on the command line, GHC will be
981 clever. It compares the version numbers on the things it needs this
982 time with the version numbers on the things it needed last time
983 (gleaned from the interface file of the module being compiled); if
984 they are all the same it stops compiling rather early in the process
985 saying “Compilation IS NOT required”. What a beautiful
990 Patrick Sansom had a workshop paper about how all this is done (though
991 the details have changed quite a bit). <ULink URL="mailto:sansom@dcs.gla.ac.uk">Ask him</ULink> if you want a copy.
994 <Sect3 id="packages">
995 <Title>Packages</Title>
998 <IndexTerm><Primary>packages</Primary></IndexTerm>
999 To simplify organisation and compilation, GHC keeps libraries in <Emphasis>packages</Emphasis>. Packages are also compiled into single libraries on Unix, and DLLs on Windows. The term ``package'' can be used pretty much synonymously with ``library'', except that an application also forms a package, the Main package.
1005 A package is a group of modules. It may span many directories, or many packages may exist in a single directory. Packages may not be mutually recursive.
1011 A package has a name (e.g. <Filename>std</Filename>)
1017 Each package is built into a single library (Unix; e.g. <Filename>libHSfoo.a</Filename>), or a single DLL (Windows; e.g. <Filename>HSfoo.dll</Filename>)
1023 The <Option>-package-name foo</Option> flag tells GHC that the module being compiled is destined for package <Filename>foo</Filename>. If this is omitted, the default package, <Filename>Main</Filename>, is assumed.
1029 The <Option>-package foo</Option> flag tells GHC to make available modules
1030 from package <Filename>foo</Filename>. It replaces <Option>-syslib foo</Option>, which is now deprecated.
1036 GHC does not maintain detailed cross-package dependency information.
1037 It does remember which modules in other packages the current module
1038 depends on, but not which things within those imported things.
1044 All of this tidies up the Prelude enormously. The Prelude and
1045 Standard Libraries are built into a single package called <Filename>std</Filename>. (This
1046 is a change; the library is now called <Filename>libHSstd.a</Filename> instead of <Filename>libHS.a</Filename>).
1050 It is worth noting that on Windows, because each package is built as a DLL, and a reference to a DLL costs an extra indirection, intra-package references are cheaper than inter-package references. Of course, this applies to the <Filename>Main</Filename> package as well. This is not normally the case on most Unices.
1058 <Sect2 id="using-make">
1059 <Title>Using <Command>make</Command>
1063 <IndexTerm><Primary><literal>make</literal></Primary></IndexTerm>
1067 It is reasonably straightforward to set up a <Filename>Makefile</Filename> to use with
1068 GHC, assuming you name your source files the same as your modules.
1076 HC_OPTS = -cpp $(EXTRA_HC_OPTS)
1078 SRCS = Main.lhs Foo.lhs Bar.lhs
1079 OBJS = Main.o Foo.o Bar.o
1081 .SUFFIXES : .o .hi .lhs .hc .s
1085 $(HC) -o $@ $(HC_OPTS) $(OBJS)
1087 # Standard suffix rules
1092 $(HC) -c $< $(HC_OPTS)
1095 $(HC) -c $< $(HC_OPTS)
1097 # Inter-module dependencies
1098 Foo.o Foo.hc Foo.s : Baz.hi # Foo imports Baz
1099 Main.o Main.hc Main.s : Foo.hi Baz.hi # Main imports Foo and Baz
1105 (Sophisticated <Command>make</Command> variants may achieve some of the above more
1106 elegantly. Notably, <Command>gmake</Command>'s pattern rules let you write the more
1114 $(HC) -c $< $(HC_OPTS)
1120 What we've shown should work with any <Command>make</Command>.)
1124 Note the cheesy <Literal>.o.hi</Literal> rule: It records the dependency of the
1125 interface (<Filename>.hi</Filename>) file on the source. The rule says a <Filename>.hi</Filename> file can
1126 be made from a <Filename>.o</Filename> file by doing…nothing. Which is true.
1130 Note the inter-module dependencies at the end of the Makefile, which
1137 Foo.o Foo.hc Foo.s : Baz.hi # Foo imports Baz
1143 They tell <Command>make</Command> that if any of <Literal>Foo.o</Literal>, <Literal>Foo.hc</Literal> or <Literal>Foo.s</Literal> have an
1144 earlier modification date than <Literal>Baz.hi</Literal>, then the out-of-date file
1145 must be brought up to date. To bring it up to date, <Literal>make</Literal> looks for
1146 a rule to do so; one of the preceding suffix rules does the job
1151 Putting inter-dependencies of the form <Literal>Foo.o : Bar.hi</Literal> into your
1152 <Filename>Makefile</Filename> by hand is rather error-prone. Don't worry—never fear,
1153 <Command>mkdependHS</Command> is here! (and is distributed as part of GHC) Add the
1154 following to your <Filename>Makefile</Filename>:
1161 mkdependHS -- $(HC_OPTS) -- $(SRCS)
1167 Now, before you start compiling, and any time you change the <Literal>imports</Literal>
1168 in your program, do <Command>make depend</Command> before you do <Command>make cool_pgm</Command>.
1169 <Command>mkdependHS</Command> will append the needed dependencies to your <Filename>Makefile</Filename>.
1170 <Command>mkdependHS</Command> is fully described in <XRef LinkEnd="mkdependHS">.
1174 A few caveats about this simple scheme:
1183 You may need to compile some modules explicitly to create their
1184 interfaces in the first place (e.g., <Command>make Bar.o</Command> to create <Filename>Bar.hi</Filename>).
1191 You may have to type <Command>make</Command> more than once for the dependencies
1192 to have full effect. However, a <Command>make</Command> run that does nothing
1193 <Emphasis>does</Emphasis> mean “everything's up-to-date.”
1200 This scheme will work with mutually-recursive modules but,
1201 again, it may take multiple iterations to “settle.”
1212 <Sect2 id="mutual-recursion">
1213 <Title>How to compile mutually recursive modules
1217 <IndexTerm><Primary>module system, recursion</Primary></IndexTerm>
1218 <IndexTerm><Primary>recursion, between modules</Primary></IndexTerm>
1222 Currently, the compiler does not have proper support for dealing with
1223 mutually recursive modules:
1233 newtype TA = MkTA Int
1251 When compiling either module A and B, the compiler will try (in vain)
1252 to look for the interface file of the other. So, to get mutually
1253 recursive modules off the ground, you need to hand write an interface
1254 file for A or B, so as to break the loop. These hand-written
1255 interface files are called <Literal>hi-boot</Literal> files, and are placed in a file
1256 called <Filename><module>.hi-boot</Filename>. To import from an <Literal>hi-boot</Literal> file instead
1257 of the standard <Filename>.hi</Filename> file, use the following syntax in the importing module:
1258 <IndexTerm><Primary>hi-boot files</Primary></IndexTerm>
1259 <IndexTerm><Primary>importing, hi-boot files</Primary></IndexTerm>
1265 import {-# SOURCE #-} A
1271 The hand-written interface need only contain the bare minimum of
1272 information needed to get the bootstrapping process started. For
1273 example, it doesn't need to contain declarations for <Emphasis>everything</Emphasis>
1274 that module <Literal>A</Literal> exports, only the things required by the module that
1275 imports <Literal>A</Literal> recursively.
1279 For the example at hand, the boot interface file for A would look like
1286 __interface A 1 404 where
1287 __export A TA{MkTA} ;
1288 1 newtype TA = MkTA PrelBase.Int ;
1294 The syntax is essentially the same as a normal <Filename>.hi</Filename> file
1295 (unfortunately), but you can usually tailor an existing <Filename>.hi</Filename> file to
1296 make a <Filename>.hi-boot</Filename> file.
1300 Notice that we only put the declaration for the newtype <Literal>TA</Literal> in the
1301 <Literal>hi-boot</Literal> file, not the signature for <Function>f</Function>, since <Function>f</Function> isn't used by
1302 <Literal>B</Literal>.
1306 The number “1” after “__interface A” gives the version number of module A;
1307 it is incremented whenever anything in A's interface file changes. The “404” is
1308 the version number of the interface file <Emphasis>syntax</Emphasis>; we change it when
1309 we change the syntax of interface files so that you get a better error message when
1310 you try to read an old-format file with a new-format compiler.
1314 The number “1” at the beginning of a declaration is the <Emphasis>version
1315 number</Emphasis> of that declaration: for the purposes of <Filename>.hi-boot</Filename> files
1316 these can all be set to 1. All names must be fully qualified with the
1317 <Emphasis>original</Emphasis> module that an object comes from: for example, the
1318 reference to <Literal>Int</Literal> in the interface for <Literal>A</Literal> comes from <Literal>PrelBase</Literal>,
1319 which is a module internal to GHC's prelude. It's a pain, but that's
1324 If you want an hi-boot file to export a data type, but you don't want to give its constructors
1325 (because the constructors aren't used by the SOURCE-importing module), you can write simply:
1331 __interface A 1 404 where
1339 (You must write all the type parameters, but leave out the '=' and everything that follows it.)
1343 <Emphasis>Note:</Emphasis> This is all a temporary solution, a version of the
1344 compiler that handles mutually recursive modules properly without the manual
1345 construction of interface files, is (allegedly) in the works.
1352 <Sect1 id="options-optimise">
1353 <Title>Optimisation (code improvement)
1357 <IndexTerm><Primary>optimisation (GHC)</Primary></IndexTerm>
1358 <IndexTerm><Primary>improvement, code (GHC)</Primary></IndexTerm>
1362 The <Option>-O*</Option> options specify convenient “packages” of optimisation
1363 flags; the <Option>-f*</Option> options described later on specify
1364 <Emphasis>individual</Emphasis> optimisations to be turned on/off; the <Option>-m*</Option>
1365 options specify <Emphasis>machine-specific</Emphasis> optimisations to be turned
1369 <Sect2 id="optimise-pkgs">
1370 <Title><Option>-O*</Option>: convenient “packages” of optimisation flags.
1374 <IndexTerm><Primary>-O options</Primary></IndexTerm>
1378 There are <Emphasis>many</Emphasis> options that affect the quality of code
1379 produced by GHC. Most people only have a general goal, something like
1380 “Compile quickly” or “Make my program run like greased lightning.”
1381 The following “packages” of optimisations (or lack thereof) should
1386 Once you choose a <Option>-O*</Option> “package,” stick with it—don't chop and
1387 change. Modules' interfaces <Emphasis>will</Emphasis> change with a shift to a new
1388 <Option>-O*</Option> option, and you may have to recompile a large chunk of all
1389 importing modules before your program can again be run
1390 safely (see <XRef LinkEnd="recomp">).
1397 <Term>No <Option>-O*</Option>-type option specified:</Term>
1398 <IndexTerm><Primary>-O* not specified</Primary></IndexTerm>
1401 This is taken to mean: “Please compile quickly; I'm not over-bothered
1402 about compiled-code quality.” So, for example: <Command>ghc -c Foo.hs</Command>
1407 <Term><Option>-O</Option> or <Option>-O1</Option>:</Term>
1408 <IndexTerm><Primary>-O option</Primary></IndexTerm>
1409 <IndexTerm><Primary>-O1 option</Primary></IndexTerm>
1410 <IndexTerm><Primary>optimise</Primary><secondary>normally</secondary></IndexTerm>
1413 Means: “Generate good-quality code without taking too long about
1414 it.” Thus, for example: <Command>ghc -c -O Main.lhs</Command>
1419 <Term><Option>-O2</Option>:</Term>
1420 <IndexTerm><Primary>-O2 option</Primary></IndexTerm>
1421 <IndexTerm><Primary>optimise</Primary><secondary>aggressively</secondary></IndexTerm>
1424 Means: “Apply every non-dangerous optimisation, even if it means
1425 significantly longer compile times.”
1429 The avoided “dangerous” optimisations are those that can make
1430 runtime or space <Emphasis>worse</Emphasis> if you're unlucky. They are
1431 normally turned on or off individually.
1435 At the moment, <Option>-O2</Option> is <Emphasis>unlikely</Emphasis> to produce
1436 better code than <Option>-O</Option>.
1441 <Term><Option>-O2-for-C</Option>:</Term>
1442 <IndexTerm><Primary>-O2-for-C option</Primary></IndexTerm>
1443 <IndexTerm><Primary>gcc, invoking with -O2</Primary></IndexTerm>
1446 Says to run GCC with <Option>-O2</Option>, which may be worth a few percent in
1447 execution speed. Don't forget <Option>-fvia-C</Option>, lest you use the native-code
1448 generator and bypass GCC altogether!
1453 <Term><Option>-Onot</Option>:</Term>
1454 <IndexTerm><Primary>-Onot option</Primary></IndexTerm>
1455 <IndexTerm><Primary>optimising, reset</Primary></IndexTerm>
1458 This option will make GHC “forget” any
1459 <Option>-O</Option>ish options it has seen so far. Sometimes useful;
1460 for example: <Command>make all
1461 EXTRA_HC_OPTS=-Onot</Command>.
1466 <Term><Option>-Ofile <file></Option>:</Term>
1467 <IndexTerm><Primary>-Ofile <file> option</Primary></IndexTerm>
1468 <IndexTerm><Primary>optimising, customised</Primary></IndexTerm>
1471 For those who need <Emphasis>absolute</Emphasis> control over
1472 <Emphasis>exactly</Emphasis> what options are used (e.g., compiler
1473 writers, sometimes :-), a list of options can be put in a file and
1474 then slurped in with <Option>-Ofile</Option>.
1478 In that file, comments are of the
1479 <Literal>#</Literal>-to-end-of-line variety; blank lines and most
1480 whitespace is ignored.
1484 Please ask if you are baffled and would like an example of <Option>-Ofile</Option>!
1492 At Glasgow, we don't use a <Option>-O*</Option> flag for day-to-day work. We use
1493 <Option>-O</Option> to get respectable speed; e.g., when we want to measure
1494 something. When we want to go for broke, we tend to use <Option>-O -fvia-C
1495 -O2-for-C</Option> (and we go for lots of coffee breaks).
1499 The easiest way to see what <Option>-O</Option> (etc.) “really mean” is to run with
1500 <Option>-v</Option>, then stand back in amazement. Alternatively, just look at the
1501 <Literal>HsC_minus<blah></Literal> lists in the GHC driver script.
1507 <Title><Option>-f*</Option>: platform-independent flags</Title>
1510 <IndexTerm><Primary>-f* options (GHC)</Primary></IndexTerm>
1511 <IndexTerm><Primary>-fno-* options (GHC)</Primary></IndexTerm>
1515 Flags can be turned <Emphasis>off</Emphasis> individually. (NB: I hope you have a
1516 good reason for doing this…) To turn off the <Option>-ffoo</Option> flag, just use
1517 the <Option>-fno-foo</Option> flag.<IndexTerm><Primary>-fno-<opt> anti-option</Primary></IndexTerm> So, for
1518 example, you can say <Option>-O2 -fno-strictness</Option>, which will then drop out
1519 any running of the strictness analyser.
1523 The options you are most likely to want to turn off are:
1529 <Option>-fno-strictness</Option><IndexTerm><Primary>-fno-strictness option</Primary></IndexTerm> (strictness
1530 analyser, because it is sometimes slow),
1536 <Option>-fno-specialise</Option><IndexTerm><Primary>-fno-specialise option</Primary></IndexTerm> (automatic
1537 specialisation of overloaded functions, because it can make your code
1538 bigger) (US spelling also accepted), and
1544 <Option>-fno-cpr-analyse</Option><IndexTerm><Primary>-fno-cpr-analyse option</Primary></IndexTerm> switches off the CPR (constructed product
1554 Should you wish to turn individual flags <Emphasis>on</Emphasis>, you are advised
1555 to use the <Option>-Ofile</Option> option, described above. Because the order in
1556 which optimisation passes are run is sometimes crucial, it's quite
1557 hard to do with command-line options.
1561 Here are some “dangerous” optimisations you <Emphasis>might</Emphasis> want to try:
1565 <Term><Option>-fvia-C</Option>:</Term>
1568 <IndexTerm><Primary>-fvia-C option</Primary></IndexTerm>
1569 <IndexTerm><Primary>native code generator, turning off</Primary></IndexTerm>
1573 Compile via C, and don't use the native-code generator. (There are many
1574 cases when GHC does this on its own.) You might pick up a little bit of
1575 speed by compiling via C (e.g. for floating-point intensive code on Intel).
1576 If you use <Function>_casm_</Function>s (which are utterly
1577 deprecated), you probably <Emphasis>have</Emphasis> to use
1578 <Option>-fvia-C</Option>.
1582 The lower-case incantation, <Option>-fvia-c</Option>, is synonymous.
1586 Compiling via C will probably be slower (in compilation time) than
1587 using GHC's native code generator.
1592 <Term><Option>-funfolding-interface-threshold<n></Option>:</Term>
1595 <IndexTerm><Primary>-funfolding-interface-threshold option</Primary></IndexTerm>
1596 <IndexTerm><Primary>inlining, controlling</Primary></IndexTerm>
1597 <IndexTerm><Primary>unfolding, controlling</Primary></IndexTerm>
1598 (Default: 30) By raising or lowering this number, you can raise or
1599 lower the amount of pragmatic junk that gets spewed into interface
1600 files. (An unfolding has a “size” that reflects the cost in terms
1601 of “code bloat” of expanding that unfolding in another module. A
1602 bigger function would be assigned a bigger cost.)
1607 <Term><Option>-funfolding-creation-threshold<n></Option>:</Term>
1610 <IndexTerm><Primary>-funfolding-creation-threshold option</Primary></IndexTerm>
1611 <IndexTerm><Primary>inlining, controlling</Primary></IndexTerm>
1612 <IndexTerm><Primary>unfolding, controlling</Primary></IndexTerm>
1613 (Default: 30) This option is similar to
1614 <Option>-funfolding-interface-threshold</Option>, except that it governs unfoldings
1615 within a single module. Increasing this figure is more likely to
1616 result in longer compile times than faster code. The next option is
1622 <Term><Option>-funfolding-use-threshold<n></Option>:</Term>
1625 <IndexTerm><Primary>-funfolding-use-threshold option</Primary></IndexTerm>
1626 <IndexTerm><Primary>inlining, controlling</Primary></IndexTerm>
1627 <IndexTerm><Primary>unfolding, controlling</Primary></IndexTerm>
1628 (Default: 8) This is the magic cut-off figure for unfolding: below
1629 this size, a function definition will be unfolded at the call-site,
1630 any bigger and it won't. The size computed for a function depends on
1631 two things: the actual size of the expression minus any discounts that
1632 apply (see <Option>-funfolding-con-discount</Option>).
1637 <Term><Option>-funfolding-con-discount<n></Option>:</Term>
1640 <IndexTerm><Primary>-funfolding-con-discount option</Primary></IndexTerm>
1641 <IndexTerm><Primary>inlining, controlling</Primary></IndexTerm>
1642 <IndexTerm><Primary>unfolding, controlling</Primary></IndexTerm>
1643 (Default: 2) If the compiler decides that it can eliminate some
1644 computation by performing an unfolding, then this is a discount factor
1645 that it applies to the funciton size before deciding whether to unfold
1650 OK, folks, these magic numbers `30', `8', and '2' are mildly
1651 arbitrary; they are of the “seem to be OK” variety. The `8' is the
1652 more critical one; it's what determines how eager GHC is about
1653 expanding unfoldings.
1658 <Term><Option>-funbox-strict-fields</Option>:</Term>
1661 <IndexTerm><Primary>-funbox-strict-fields option</Primary></IndexTerm>
1662 <IndexTerm><Primary>strict constructor fields</Primary></IndexTerm>
1663 <IndexTerm><Primary>constructor fields, strict</Primary></IndexTerm>
1667 This option causes all constructor fields which are marked strict
1668 (i.e. “!”) to be unboxed or unpacked if possible. For example:
1674 data T = T !Float !Float
1680 will create a constructor <Literal>T</Literal> containing two unboxed floats if the
1681 <Option>-funbox-strict-fields</Option> flag is given. This may not always be an
1682 optimisation: if the <Function>T</Function> constructor is scrutinised and the floats
1683 passed to a non-strict function for example, they will have to be
1684 reboxed (this is done automatically by the compiler).
1688 This option should only be used in conjunction with <Option>-O</Option>, in order to
1689 expose unfoldings to the compiler so the reboxing can be removed as
1690 often as possible. For example:
1697 f (T f1 f2) = f1 + f2
1703 The compiler will avoid reboxing <Function>f1</Function> and <Function>f2</Function> by inlining <Function>+</Function> on
1704 floats, but only when <Option>-O</Option> is on.
1708 Any single-constructor data is eligible for unpacking; for example
1714 data T = T !(Int,Int)
1720 will store the two <Literal>Int</Literal>s directly in the <Function>T</Function> constructor, by flattening
1721 the pair. Multi-level unpacking is also supported:
1728 data S = S !Int !Int
1734 will store two unboxed <Literal>Int#</Literal>s directly in the <Function>T</Function> constructor.
1739 <Term><Option>-fsemi-tagging</Option>:</Term>
1742 This option (which <Emphasis>does not work</Emphasis> with the native-code generator)
1743 tells the compiler to add extra code to test for already-evaluated
1744 values. You win if you have lots of such values during a run of your
1745 program, you lose otherwise. (And you pay in extra code space.)
1749 We have not played with <Option>-fsemi-tagging</Option> enough to recommend it.
1750 (For all we know, it doesn't even work anymore… Sigh.)
1760 <Title><Option>-m*</Option>: platform-specific flags</Title>
1763 <IndexTerm><Primary>-m* options (GHC)</Primary></IndexTerm>
1764 <IndexTerm><Primary>platform-specific options</Primary></IndexTerm>
1765 <IndexTerm><Primary>machine-specific options</Primary></IndexTerm>
1769 Some flags only make sense for particular target platforms.
1776 <Term><Option>-mv8</Option>:</Term>
1779 (SPARC machines)<IndexTerm><Primary>-mv8 option (SPARC only)</Primary></IndexTerm>
1780 Means to pass the like-named option to GCC; it says to use the
1781 Version 8 SPARC instructions, notably integer multiply and divide.
1782 The similiar <Option>-m*</Option> GCC options for SPARC also work, actually.
1787 <Term><Option>-mlong-calls</Option>:</Term>
1790 (HPPA machines)<IndexTerm><Primary>-mlong-calls option (HPPA only)</Primary></IndexTerm>
1791 Means to pass the like-named option to GCC. Required for Very Big
1792 modules, maybe. (Probably means you're in trouble…)
1797 <Term><Option>-monly-[32]-regs</Option>:</Term>
1800 (iX86 machines)<IndexTerm><Primary>-monly-N-regs option (iX86 only)</Primary></IndexTerm>
1801 GHC tries to “steal” four registers from GCC, for performance
1802 reasons; it almost always works. However, when GCC is compiling some
1803 modules with four stolen registers, it will crash, probably saying:
1806 Foo.hc:533: fixed or forbidden register was spilled.
1807 This may be due to a compiler bug or to impossible asm
1808 statements or clauses.
1811 Just give some registers back with <Option>-monly-N-regs</Option>. Try `3' first,
1812 then `2'. If `2' doesn't work, please report the bug to us.
1821 <Sect2 id="optimise-C-compiler">
1822 <Title>Code improvement by the C compiler.
1826 <IndexTerm><Primary>optimisation by GCC</Primary></IndexTerm>
1827 <IndexTerm><Primary>GCC optimisation</Primary></IndexTerm>
1831 The C compiler (GCC) is run with <Option>-O</Option> turned on. (It has
1836 If you want to run GCC with <Option>-O2</Option>—which may be worth a few
1837 percent in execution speed—you can give a
1838 <Option>-O2-for-C</Option><IndexTerm><Primary>-O2-for-C option</Primary></IndexTerm> option.
1845 <Sect1 id="options-phases">
1846 <Title>Options related to a particular phase
1849 <Sect2 id="c-pre-processor">
1850 <Title>The C pre-processor
1854 <IndexTerm><Primary>pre-processing: cpp</Primary></IndexTerm>
1855 <IndexTerm><Primary>C pre-processor options</Primary></IndexTerm>
1856 <IndexTerm><Primary>cpp, pre-processing with</Primary></IndexTerm>
1860 The C pre-processor <Command>cpp</Command> is run over your Haskell code only if the
1861 <Option>-cpp</Option> option <IndexTerm><Primary>-cpp option</Primary></IndexTerm> is given. Unless you are
1862 building a large system with significant doses of conditional
1863 compilation, you really shouldn't need it.
1867 <Term><Option>-D<foo></Option>:</Term>
1870 <IndexTerm><Primary>-D<name> option</Primary></IndexTerm>
1871 Define macro <Constant><foo></Constant> in the usual way. NB: does <Emphasis>not</Emphasis> affect
1872 <Option>-D</Option> macros passed to the C compiler when compiling via C! For those,
1873 use the <Option>-optc-Dfoo</Option> hack… (see <XRef LinkEnd="forcing-options-through">).
1878 <Term><Option>-U<foo></Option>:</Term>
1881 <IndexTerm><Primary>-U<name> option</Primary></IndexTerm>
1882 Undefine macro <Command><foo></Command> in the usual way.
1887 <Term><Option>-I<dir></Option>:</Term>
1890 <IndexTerm><Primary>-I<dir> option</Primary></IndexTerm>
1891 Specify a directory in which to look for <Literal>#include</Literal> files, in
1900 The GHC driver pre-defines several macros when processing Haskell
1901 source code (<Filename>.hs</Filename> or <Filename>.lhs</Filename> files):
1908 <Term><Constant>__HASKELL98__</Constant>:</Term>
1911 <IndexTerm><Primary>__HASKELL98__</Primary></IndexTerm>
1912 If defined, this means that GHC supports the language defined by the
1918 <Term><Constant>__HASKELL__=98</Constant>:</Term>
1921 <IndexTerm><Primary>__HASKELL__</Primary></IndexTerm>
1922 In GHC 4.04 and later, the <Constant>__HASKELL__</Constant> macro is defined as having
1923 the value <Constant>98</Constant>.
1928 <Term><Constant>__HASKELL1__</Constant>:</Term>
1931 <IndexTerm><Primary>__HASKELL1__ macro</Primary></IndexTerm>
1932 If defined to <Emphasis>n</Emphasis>, that means GHC supports the Haskell language
1933 defined in the Haskell report version <Emphasis>1.n</Emphasis>. Currently 5. This
1934 macro is deprecated, and will probably disappear in future versions.
1939 <Term><Constant>__GLASGOW_HASKELL__</Constant>:</Term>
1942 <IndexTerm><Primary>__GLASGOW_HASKELL__ macro</Primary></IndexTerm>
1943 For version <Emphasis>n</Emphasis> of the GHC system, this will be <Literal>#define</Literal>d to
1944 <Emphasis>100n</Emphasis>. So, for version 4.00, it is 400.
1948 With any luck, <Constant>__GLASGOW_HASKELL__</Constant> will be undefined in all other
1949 implementations that support C-style pre-processing.
1953 (For reference: the comparable symbols for other systems are:
1954 <Constant>__HUGS__</Constant> for Hugs and <Constant>__HBC__</Constant> for Chalmers.)
1958 NB. This macro is set when pre-processing both Haskell source and C
1959 source, including the C source generated from a Haskell module
1960 (i.e. <Filename>.hs</Filename>, <Filename>.lhs</Filename>, <Filename>.c</Filename> and <Filename>.hc</Filename> files).
1965 <Term><Constant>__CONCURRENT_HASKELL__</Constant>:</Term>
1968 <IndexTerm><Primary>__CONCURRENT_HASKELL__ macro</Primary></IndexTerm>
1969 This symbol is defined when pre-processing Haskell (input) and
1970 pre-processing C (GHC output). Since GHC from verion 4.00 now
1971 supports concurrent haskell by default, this symbol is always defined.
1976 <Term><Constant>__PARALLEL_HASKELL__</Constant>:</Term>
1979 <IndexTerm><Primary>__PARALLEL_HASKELL__ macro</Primary></IndexTerm>
1980 Only defined when <Option>-parallel</Option> is in use! This symbol is defined when
1981 pre-processing Haskell (input) and pre-processing C (GHC output).
1989 Options other than the above can be forced through to the C
1990 pre-processor with the <Option>-opt</Option> flags (see
1991 <XRef LinkEnd="forcing-options-through">).
1995 A small word of warning: <Option>-cpp</Option> is not friendly to “string
1996 gaps”.<IndexTerm><Primary>-cpp vs string gaps</Primary></IndexTerm><IndexTerm><Primary>string gaps vs
1997 -cpp</Primary></IndexTerm>. In other words, strings such as the following:
2011 don't work with <Option>-cpp</Option>; <Filename>/usr/bin/cpp</Filename> elides the
2012 backslash-newline pairs.
2016 However, it appears that if you add a space at the end of the line,
2017 then <Command>cpp</Command> (at least GNU <Command>cpp</Command> and possibly other <Command>cpp</Command>s)
2018 leaves the backslash-space pairs alone and the string gap works as
2024 <Sect2 id="options-C-compiler">
2025 <Title>Options affecting the C compiler (if applicable)
2029 <IndexTerm><Primary>include-file options</Primary></IndexTerm>
2030 <IndexTerm><Primary>C compiler options</Primary></IndexTerm>
2031 <IndexTerm><Primary>GCC options</Primary></IndexTerm>
2035 At the moment, quite a few common C-compiler options are passed on
2036 quietly to the C compilation of Haskell-compiler-generated C files.
2037 THIS MAY CHANGE. Meanwhile, options so sent are:
2044 <ColSpec Align="Left" Colsep="0">
2045 <ColSpec Align="Left" Colsep="0">
2048 <Entry><Option>-ansi</Option> </Entry>
2049 <Entry> do ANSI C (not K&R) </Entry>
2053 <Option>-pedantic</Option> </Entry>
2054 <Entry> be so</Entry>
2058 <Option>-dgcc-lint</Option> </Entry>
2059 <Entry> (hack) short for “make GCC very paranoid”</Entry>
2067 <IndexTerm><Primary>-ansi option (for GCC)</Primary></IndexTerm>
2068 <IndexTerm><Primary>-pedantic option (for GCC)</Primary></IndexTerm>
2069 <IndexTerm><Primary>-dgcc-lint option (GCC paranoia)</Primary></IndexTerm>
2073 If you are compiling with lots of foreign calls, you may need to
2074 tell the C compiler about some <Literal>#include</Literal> files. There is no real
2075 pretty way to do this, but you can use this hack from the
2082 % ghc -c '-#include <X/Xlib.h>' Xstuff.lhs
2089 <Sect2 id="options-linker">
2090 <Title>Linking and consistency-checking
2094 <IndexTerm><Primary>linker options</Primary></IndexTerm>
2095 <IndexTerm><Primary>ld options</Primary></IndexTerm>
2099 GHC has to link your code with various libraries, possibly including:
2100 user-supplied, GHC-supplied, and system-supplied (<Option>-lm</Option> math
2101 library, for example).
2108 <Term><Option>-l<FOO></Option>:</Term>
2111 <IndexTerm><Primary>-l<lib> option</Primary></IndexTerm>
2112 Link in a library named <Filename>lib<FOO>.a</Filename> which resides somewhere on the
2113 library directories path.
2117 Because of the sad state of most UNIX linkers, the order of such
2118 options does matter. Thus: <Command>ghc -lbar *.o</Command> is almost certainly
2119 wrong, because it will search <Filename>libbar.a</Filename> <Emphasis>before</Emphasis> it has
2120 collected unresolved symbols from the <Filename>*.o</Filename> files.
2121 <Command>ghc *.o -lbar</Command> is probably better.
2125 The linker will of course be informed about some GHC-supplied
2126 libraries automatically; these are:
2133 <ColSpec Align="Left" Colsep="0">
2134 <ColSpec Align="Left" Colsep="0">
2137 <Entry><Emphasis>-l equivalent</Emphasis> </Entry>
2138 <Entry> <Emphasis>description</Emphasis> </Entry>
2143 <Option>-lHSrts,-lHSclib</Option> </Entry>
2144 <Entry> basic runtime libraries </Entry>
2148 <Option>-lHS</Option> </Entry>
2149 <Entry> standard Prelude library </Entry>
2153 <Option>-lHS_cbits</Option> </Entry>
2154 <Entry> C support code for standard Prelude library </Entry>
2158 <Option>-lgmp</Option> </Entry>
2159 <Entry> GNU multi-precision library (for Integers)</Entry>
2170 <IndexTerm><Primary>-lHS library</Primary></IndexTerm>
2171 <IndexTerm><Primary>-lHS_cbits library</Primary></IndexTerm>
2172 <IndexTerm><Primary>-lHSrts library</Primary></IndexTerm>
2173 <IndexTerm><Primary>-lgmp library</Primary></IndexTerm>
2178 <Term><Option>-syslib <name></Option>:</Term>
2181 <IndexTerm><Primary>-syslib <name> option</Primary></IndexTerm>
2185 If you are using a Haskell “system library” (e.g., the POSIX
2186 library), just use the <Option>-syslib posix</Option> option, and the correct code
2187 should be linked in.
2192 <Term><Option>-L<dir></Option>:</Term>
2195 <IndexTerm><Primary>-L<dir> option</Primary></IndexTerm>
2196 Where to find user-supplied libraries… Prepend the directory
2197 <Filename><dir></Filename> to the library directories path.
2202 <Term><Option>-static</Option>:</Term>
2205 <IndexTerm><Primary>-static option</Primary></IndexTerm>
2206 Tell the linker to avoid shared libraries.
2211 <Term><Option>-no-link-chk</Option> and <Option>-link-chk</Option>:</Term>
2214 <IndexTerm><Primary>-no-link-chk option</Primary></IndexTerm>
2215 <IndexTerm><Primary>-link-chk option</Primary></IndexTerm>
2216 <IndexTerm><Primary>consistency checking of executables</Primary></IndexTerm>
2217 By default, immediately after linking an executable, GHC verifies that
2218 the pieces that went into it were compiled with compatible flags; a
2219 “consistency check”.
2220 (This is to avoid mysterious failures caused by non-meshing of
2221 incompatibly-compiled programs; e.g., if one <Filename>.o</Filename> file was compiled
2222 for a parallel machine and the others weren't.) You may turn off this
2223 check with <Option>-no-link-chk</Option>. You can turn it (back) on with
2224 <Option>-link-chk</Option> (the default).
2229 <Term><Option>-no-hs-main</Option>:</Term>
2232 <IndexTerm><Primary>-no-hs-main option</Primary></IndexTerm>
2233 <IndexTerm><Primary>linking Haskell libraries with foreign code</Primary></IndexTerm>
2237 In the event you want to include ghc-compiled code as part of another
2238 (non-Haskell) program, the RTS will not be supplying its definition of
2239 <Function>main()</Function> at link-time, you will have to. To signal that to the
2240 driver script when linking, use <Option>-no-hs-main</Option>.
2244 Notice that since the command-line passed to the linker is rather
2245 involved, you probably want to use the ghc driver script to do the
2246 final link of your `mixed-language' application. This is not a
2247 requirement though, just try linking once with <Option>-v</Option> on to see what
2248 options the driver passes through to the linker.
2259 <Sect1 id="sec-using-concurrent">
2260 <Title>Using Concurrent Haskell</Title>
2263 <IndexTerm><Primary>Concurrent Haskell—use</Primary></IndexTerm>
2267 GHC (as of version 4.00) supports Concurrent Haskell by default,
2268 without requiring a special option or libraries compiled in a certain
2269 way. To get access to the support libraries for Concurrent Haskell
2270 (i.e. <Literal>Concurrent</Literal> and friends), use the
2271 <Option>-syslib concurrent</Option> option.
2275 Three RTS options are provided for modifying the behaviour of the
2276 threaded runtime system. See the descriptions of
2277 <Option>-C[<us>]</Option>, <Option>-q</Option>, and
2278 <Option>-t<num></Option> in <XRef LinkEnd="parallel-rts-opts">.
2282 Concurrent Haskell is described in more detail in <XRef
2283 LinkEnd="sec-Concurrent">.
2288 <Sect1 id="sec-using-parallel">
2289 <Title>Using Parallel Haskell</Title>
2292 <IndexTerm><Primary>Parallel Haskell—use</Primary></IndexTerm>
2296 [You won't be able to execute parallel Haskell programs unless PVM3
2297 (Parallel Virtual Machine, version 3) is installed at your site.]
2301 To compile a Haskell program for parallel execution under PVM, use the
2302 <Option>-parallel</Option> option,<IndexTerm><Primary>-parallel
2303 option</Primary></IndexTerm> both when compiling <Emphasis>and
2304 linking</Emphasis>. You will probably want to <Literal>import
2305 Parallel</Literal> into your Haskell modules.
2309 To run your parallel program, once PVM is going, just invoke it
2310 “as normal”. The main extra RTS option is
2311 <Option>-N<n></Option>, to say how many PVM
2312 “processors” your program to run on. (For more details of
2313 all relevant RTS options, please see <XRef
2314 LinkEnd="parallel-rts-opts">.)
2318 In truth, running Parallel Haskell programs and getting information
2319 out of them (e.g., parallelism profiles) is a battle with the vagaries of
2320 PVM, detailed in the following sections.
2324 <Title>Dummy's guide to using PVM</Title>
2327 <IndexTerm><Primary>PVM, how to use</Primary></IndexTerm>
2328 <IndexTerm><Primary>Parallel Haskell—PVM use</Primary></IndexTerm>
2329 Before you can run a parallel program under PVM, you must set the
2330 required environment variables (PVM's idea, not ours); something like,
2331 probably in your <Filename>.cshrc</Filename> or equivalent:
2334 setenv PVM_ROOT /wherever/you/put/it
2335 setenv PVM_ARCH `$PVM_ROOT/lib/pvmgetarch`
2336 setenv PVM_DPATH $PVM_ROOT/lib/pvmd
2342 Creating and/or controlling your “parallel machine” is a purely-PVM
2343 business; nothing specific to Parallel Haskell.
2347 You use the <Command>pvm</Command><IndexTerm><Primary>pvm command</Primary></IndexTerm> command to start PVM on your
2348 machine. You can then do various things to control/monitor your
2349 “parallel machine;” the most useful being:
2355 <ColSpec Align="Left">
2359 <Entry><KeyCombo><KeyCap>Control</KeyCap><KeyCap>D</KeyCap></KeyCombo></Entry>
2360 <Entry>exit <Command>pvm</Command>, leaving it running</Entry>
2364 <Entry><Command>halt</Command></Entry>
2365 <Entry>kill off this “parallel machine” & exit</Entry>
2369 <Entry><Command>add <host></Command></Entry>
2370 <Entry>add <Command><host></Command> as a processor</Entry>
2374 <Entry><Command>delete <host></Command></Entry>
2375 <Entry>delete <Command><host></Command></Entry>
2379 <Entry><Command>reset</Command></Entry>
2380 <Entry>kill what's going, but leave PVM up</Entry>
2384 <Entry><Command>conf</Command></Entry>
2385 <Entry>list the current configuration</Entry>
2389 <Entry><Command>ps</Command></Entry>
2390 <Entry>report processes' status</Entry>
2394 <Entry><Command>pstat <pid></Command></Entry>
2395 <Entry>status of a particular process</Entry>
2404 The PVM documentation can tell you much, much more about <Command>pvm</Command>!
2410 <Title>Parallelism profiles</Title>
2413 <IndexTerm><Primary>parallelism profiles</Primary></IndexTerm>
2414 <IndexTerm><Primary>profiles, parallelism</Primary></IndexTerm>
2415 <IndexTerm><Primary>visualisation tools</Primary></IndexTerm>
2419 With Parallel Haskell programs, we usually don't care about the
2420 results—only with “how parallel” it was! We want pretty pictures.
2424 Parallelism profiles (à la <Command>hbcpp</Command>) can be generated with the
2425 <Option>-q</Option><IndexTerm><Primary>-q RTS option (concurrent, parallel)</Primary></IndexTerm> RTS option. The
2426 per-processor profiling info is dumped into files named
2427 <Filename><full-path><program>.gr</Filename>. These are then munged into a PostScript picture,
2428 which you can then display. For example, to run your program
2429 <Filename>a.out</Filename> on 8 processors, then view the parallelism profile, do:
2435 % ./a.out +RTS -N8 -q
2436 % grs2gr *.???.gr > temp.gr # combine the 8 .gr files into one
2437 % gr2ps -O temp.gr # cvt to .ps; output in temp.ps
2438 % ghostview -seascape temp.ps # look at it!
2444 The scripts for processing the parallelism profiles are distributed
2445 in <Filename>ghc/utils/parallel/</Filename>.
2451 <Title>Other useful info about running parallel programs</Title>
2454 The “garbage-collection statistics” RTS options can be useful for
2455 seeing what parallel programs are doing. If you do either
2456 <Option>+RTS -Sstderr</Option><IndexTerm><Primary>-Sstderr RTS option</Primary></IndexTerm> or <Option>+RTS -sstderr</Option>, then
2457 you'll get mutator, garbage-collection, etc., times on standard
2458 error. The standard error of all PE's other than the `main thread'
2459 appears in <Filename>/tmp/pvml.nnn</Filename>, courtesy of PVM.
2463 Whether doing <Option>+RTS -Sstderr</Option> or not, a handy way to watch
2464 what's happening overall is: <Command>tail -f /tmp/pvml.nnn</Command>.
2469 <Sect2 id="parallel-rts-opts">
2470 <Title>RTS options for Concurrent/Parallel Haskell
2474 <IndexTerm><Primary>RTS options, concurrent</Primary></IndexTerm>
2475 <IndexTerm><Primary>RTS options, parallel</Primary></IndexTerm>
2476 <IndexTerm><Primary>Concurrent Haskell—RTS options</Primary></IndexTerm>
2477 <IndexTerm><Primary>Parallel Haskell—RTS options</Primary></IndexTerm>
2481 Besides the usual runtime system (RTS) options
2482 (<XRef LinkEnd="runtime-control">), there are a few options particularly
2483 for concurrent/parallel execution.
2490 <Term><Option>-N<N></Option>:</Term>
2493 <IndexTerm><Primary>-N<N> RTS option (parallel)</Primary></IndexTerm>
2494 (PARALLEL ONLY) Use <Literal><N></Literal> PVM processors to run this program;
2500 <Term><Option>-C[<us>]</Option>:</Term>
2503 <IndexTerm><Primary>-C<us> RTS option</Primary></IndexTerm>
2504 Sets the context switch interval to <Literal><us></Literal> microseconds. A context
2505 switch will occur at the next heap allocation after the timer expires.
2506 With <Option>-C0</Option> or <Option>-C</Option>, context switches will occur as often as
2507 possible (at every heap allocation). By default, context switches
2508 occur every 10 milliseconds. Note that many interval timers are only
2509 capable of 10 millisecond granularity, so the default setting may be
2510 the finest granularity possible, short of a context switch at every
2515 [NOTE: this option currently has no effect (version 4.00). Context
2516 switches happen when the current heap block is full, i.e. every 4k of
2522 <Term><Option>-q[v]</Option>:</Term>
2525 <IndexTerm><Primary>-q RTS option</Primary></IndexTerm>
2526 (PARALLEL ONLY) Produce a quasi-parallel profile of thread activity,
2527 in the file <FIlename><program>.qp</FIlename>. In the style of <Command>hbcpp</Command>, this profile
2528 records the movement of threads between the green (runnable) and red
2529 (blocked) queues. If you specify the verbose suboption (<Option>-qv</Option>), the
2530 green queue is split into green (for the currently running thread
2531 only) and amber (for other runnable threads). We do not recommend
2532 that you use the verbose suboption if you are planning to use the
2533 <Command>hbcpp</Command> profiling tools or if you are context switching at every heap
2534 check (with <Option>-C</Option>).
2539 <Term><Option>-t<num></Option>:</Term>
2542 <IndexTerm><Primary>-t<num> RTS option</Primary></IndexTerm>
2543 (PARALLEL ONLY) Limit the number of concurrent threads per processor
2544 to <Literal><num></Literal>. The default is 32. Each thread requires slightly over 1K
2545 <Emphasis>words</Emphasis> in the heap for thread state and stack objects. (For
2546 32-bit machines, this translates to 4K bytes, and for 64-bit machines,
2552 <Term><Option>-d</Option>:</Term>
2555 <IndexTerm><Primary>-d RTS option (parallel)</Primary></IndexTerm>
2556 (PARALLEL ONLY) Turn on debugging. It pops up one xterm (or GDB, or
2557 something…) per PVM processor. We use the standard <Command>debugger</Command>
2558 script that comes with PVM3, but we sometimes meddle with the
2559 <Command>debugger2</Command> script. We include ours in the GHC distribution,
2560 in <Filename>ghc/utils/pvm/</Filename>.
2565 <Term><Option>-e<num></Option>:</Term>
2568 <IndexTerm><Primary>-e<num> RTS option (parallel)</Primary></IndexTerm>
2569 (PARALLEL ONLY) Limit the number of pending sparks per processor to
2570 <Literal><num></Literal>. The default is 100. A larger number may be appropriate if
2571 your program generates large amounts of parallelism initially.
2576 <Term><Option>-Q<num></Option>:</Term>
2579 <IndexTerm><Primary>-Q<num> RTS option (parallel)</Primary></IndexTerm>
2580 (PARALLEL ONLY) Set the size of packets transmitted between processors
2581 to <Literal><num></Literal>. The default is 1024 words. A larger number may be
2582 appropriate if your machine has a high communication cost relative to
2600 ;;; Local Variables: ***
2602 ;;; sgml-parent-document: ("users_guide.sgml" "book" "chapter") ***