X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=docs%2Fusers_guide%2Fusing.xml;h=2828c6ae5bdda9958b49c282764697de7dd7caeb;hb=1bf40a4b38180b8b1c1bdaf4919bc327d5b27abe;hp=cc5045e1b9fd580d527d7098c65db9217c01127e;hpb=4b7d8ae0cdf92b0d8789676a4be89b41a4582472;p=ghc-hetmet.git
diff --git a/docs/users_guide/using.xml b/docs/users_guide/using.xml
index cc5045e..2828c6a 100644
--- a/docs/users_guide/using.xml
+++ b/docs/users_guide/using.xml
@@ -78,7 +78,7 @@ Hello World!
Options overview
-
+
GHC's behaviour is controlled by
options, which for historical reasons are
also sometimes referred to as command-line flags or arguments.
@@ -86,11 +86,11 @@ Hello World!
Command-line arguments
-
+
structure, command-linecommand-lineargumentsargumentscommand-line
-
+
An invocation of GHC takes the following form:
@@ -112,7 +112,7 @@ ghc [argument...]
Command line options in source files
-
+
source-file optionsSometimes it is useful to make the connection between a
@@ -130,7 +130,7 @@ ghc [argument...]
module X where
...
-
+
OPTIONS_GHC is a file-header pragma
(see ).
@@ -163,7 +163,7 @@ module X where
for more details.
-
+
Static, Dynamic, and Mode optionsstaticoptions
@@ -204,14 +204,14 @@ module X where
-
+
The flag reference tables () lists the status of each flag.There are a few flags that are static except that they can
also be used with GHCi's :set command; these
are listed as “static/:set” in the
- table.
+ table.
@@ -266,7 +266,7 @@ module X where
compiler.
-
+
.ll
@@ -336,7 +336,7 @@ module X where
more detail in .
-
+
ghc ––make
@@ -375,7 +375,7 @@ module X where
more details.
-
+
@@ -531,7 +531,7 @@ module X where
Using ghcseparate compilation
-
+
In this mode, GHC will build a multi-module Haskell program by following
dependencies from one or more root modules (usually just
Main). For example, if your
@@ -583,7 +583,7 @@ ghc Main.hs
source.
-
+
Any of the command-line options described in the rest of
this chapter can be used with
, but note that any options
@@ -596,7 +596,7 @@ ghc Main.hs
(say, some auxiliary C code), then the object files can be
given on the command line and GHC will include them when linking
the executable.
-
+
Note that GHC can only follow dependencies if it has the
source file available, so if your program includes a module for
which there is no source file, even if you have an object and an
@@ -609,7 +609,7 @@ ghc Main.hs
to add directories to the search path (see ).
-
+
Expression evaluation mode
@@ -633,7 +633,7 @@ ghc -e expr
ghc -e Main.main Main.hs
-
+
or we can just use this mode to evaluate expressions in
the context of the Prelude:
@@ -646,22 +646,22 @@ olleh
Batch compiler mode
-
+
In batch mode, GHC will compile one or more source files
given on the command line.
-
+
The first phase to run is determined by each input-file
suffix, and the last phase is determined by a flag. If no
relevant flag is present, then go all the way through to linking.
This table summarises:
-
+
-
+
Phase of the compilation system
@@ -677,7 +677,7 @@ olleh
-.hs
-
+
C pre-processor (opt.) .hs (with
@@ -685,28 +685,28 @@ olleh
.hspp
-
+
Haskell compiler.hs, .hc, .s
-
+
C compiler (opt.).hc or .c.s
-
+
assembler.s.o
-
+
linkerother
@@ -716,17 +716,17 @@ olleh
-
+
-
+
Thus, a common invocation would be:
ghc -c Foo.hs
-
+
to compile the Haskell source file
Foo.hs to an object file
Foo.o.
@@ -741,7 +741,7 @@ ghc -c Foo.hs
flag turns it on. See for more
details.
-
+
Note: The option -E
option runs just the pre-processing passes
of the compiler, dumping the result in a file.
@@ -783,18 +783,6 @@ ghc -c Foo.hs
-
-
-
-
- Does a dry-run, i.e. GHC goes through all the motions
- of compiling as normal, but does not actually run any
- external commands.
-
-
-
-
-
@@ -812,7 +800,7 @@ ghc -c Foo.hs
verify.
-
+
n
@@ -824,7 +812,7 @@ ghc -c Foo.hs
argument. Specifying on its own is
equivalent to , and the other levels
have the following meanings:
-
+
@@ -874,7 +862,7 @@ ghc -c Foo.hs
-
+
@@ -1012,7 +1000,7 @@ ghc -c Foo.hs
:
- Makes any warning into a fatal error. Useful so that you don't
+ Makes any warning into a fatal error. Useful so that you don't
miss warnings when doing batch compilation.
@@ -1217,18 +1205,18 @@ foreign import "&f" f :: FunPtr t
- ,
+ ,
:
-
+ incomplete patterns, warningpatterns, incomplete
- The option warns
+ The option warns
about places where
- a pattern-match might fail at runtime.
+ a pattern-match might fail at runtime.
The function
g below will fail when applied to
non-empty lists, so the compiler will emit a warning about
@@ -1240,7 +1228,7 @@ g [] = 2
This option isn't enabled by default because it can be
a bit noisy, and it doesn't always indicate a bug in the
program. However, it's generally considered good practice
- to cover all the cases in your functions, and it is switched
+ to cover all the cases in your functions, and it is switched
on by .The flag is
@@ -1308,17 +1296,19 @@ f foo = foo { x = 6 }
- This flag warns if you use an unqualified
+ This flag warns if you use an unqualified
import declaration
- that does not explicitly list the entities brought into scope. For
+ that does not explicitly list the entities brought into scope. For
example
+
module M where
import X( f )
import Y
import qualified Z
p x = f x x
-
+
+
The flag will warn about the import
of Y but not X
If module Y is later changed to export (say) f,
@@ -1326,6 +1316,7 @@ module M where
ambiguous. No warning is produced for the import of Z
because extending Z's exports would be unlikely to produce
ambiguity in M.
+
@@ -1348,7 +1339,7 @@ module M where
complexFn :: a -> a -> String
complexFn x y = ... _simpleFn ...
- The idea is that: (a) users of the class will only call complexFn;
+ The idea is that: (a) users of the class will only call complexFn;
never _simpleFn; and (b)
instance declarations can define either complexFn or _simpleFn.
@@ -1370,11 +1361,25 @@ module M where
+ :
+
+
+ type signatures, missing
+
+ If you use the
+ flag GHC will warn
+ you about any polymorphic local bindings. As part of
+ the warning GHC also reports the inferred type. The
+ option is off by default.
+
+
+
+ :shadowing, warning
-
+
This option causes a warning to be emitted whenever an
inner-scope value has the same name as an outer-scope value,
i.e. the inner value shadows the outer one. This can catch
@@ -1395,8 +1400,8 @@ module M where
orphan instances, warningorphan rules, warning
-
- This option causes a warning to be emitted whenever the
+
+ This option causes a warning to be emitted whenever the
module contains an "orphan" instance declaration or rewrite rule.
An instance declaration is an orphan if it appears in a module in
which neither the class nor the type being instanced are declared
@@ -1405,7 +1410,7 @@ module M where
orphans is called an orphan module.The trouble with orphans is that GHC must pro-actively read the interface
files for all orphan modules, just in case their instances or rules
- play a role, whether or not the module's interface would otherwise
+ play a role, whether or not the module's interface would otherwise
be of any use. See for details.
@@ -1493,8 +1498,8 @@ f "2" = 2
which are unused. For top-level functions, the warning is
only given if the binding is not exported.
A definition is regarded as "used" if (a) it is exported, or (b) it is
- mentioned in the right hand side of another definition that is used, or (c) the
- function it defines begins with an underscore. The last case provides a
+ mentioned in the right hand side of another definition that is used, or (c) the
+ function it defines begins with an underscore. The last case provides a
way to suppress unused-binding warnings selectively. Notice that a variable
is reported as unused even if it appears in the right-hand side of another
@@ -1542,7 +1547,7 @@ f "2" = 2
unused do binding, warningdo binding, unused
- Report expressions occuring in do and mdo blocks
+ Report expressions occurring in do and mdo blocks
that appear to silently throw information away.
For instance do { mapM popInt xs ; return 10 } would report
the first statement in the do block as suspicious,
@@ -1567,7 +1572,7 @@ f "2" = 2
apparently erroneous do binding, warningdo binding, apparently erroneous
- Report expressions occuring in do and mdo blocks
+ Report expressions occurring in do and mdo blocks
that appear to lack a binding.
For instance do { return (popInt 10) ; return 10 } would report
the first statement in the do block as suspicious,
@@ -1698,7 +1703,7 @@ f "2" = 2
We don't use a flag for day-to-day
work. We use to get respectable speed;
e.g., when we want to measure something. When we want to go for
- broke, we tend to use (and we go for
+ broke, we tend to use (and we go for
lots of coffee breaks).The easiest way to see what (etc.)
@@ -1853,7 +1858,7 @@ f "2" = 2
State# token as argument is considered to be
single-entry, hence it is considered OK to inline things inside
it. This can improve performance of IO and ST monad code, but it
- runs the risk of reducing sharing.
+ runs the risk of reducing sharing.
@@ -1917,10 +1922,10 @@ f "2" = 2
unfolding, controlling
- (Default: 45) Governs the maximum size that GHC will
+ (Default: 45) Governs the maximum size that GHC will
allow a function unfolding to be. (An unfolding has a
“size” that reflects the cost in terms of
- “code bloat” of expanding that unfolding at
+ “code bloat” of expanding that unfolding
at a call site. A bigger function would be assigned a
bigger cost.)
@@ -1954,10 +1959,10 @@ f "2" = 2
-
+
-
- &phases;
+
+ &phases;
&shared_libs;
@@ -2017,7 +2022,7 @@ f "2" = 2
use GHC to compile and run parallel programs, in we describe the language features that affect
parallelism.
-
+
Compile-time options for SMP parallelism
@@ -2025,7 +2030,7 @@ f "2" = 2
linked with the option (see ). Additionally, the following
compiler options affect parallelism:
-
+
@@ -2082,7 +2087,7 @@ f "2" = 2
results you find.. For example,
on a dual-core machine we would probably use
+RTS -N2 -RTS.
-
+
Omitting x,
i.e. +RTS -N -RTS, lets the runtime
choose the value of x itself
@@ -2144,7 +2149,7 @@ f "2" = 2
-
+
Hints for using SMP parallelism
@@ -2200,27 +2205,6 @@ f "2" = 2
-
- :
-
- (x86 only)-monly-N-regs
- option (iX86 only) GHC tries to
- “steal” four registers from GCC, for performance
- reasons; it almost always works. However, when GCC is
- compiling some modules with four stolen registers, it will
- crash, probably saying:
-
-
-Foo.hc:533: fixed or forbidden register was spilled.
-This may be due to a compiler bug or to impossible asm
-statements or clauses.
-
-
- Just give some registers back with
- . Try `3' first, then `2'.
- If `2' doesn't work, please report the bug to us.
-
-
@@ -2232,14 +2216,14 @@ statements or clauses.
intermediate code generation
- GHC can dump its optimized intermediate code (said to be in “Core” format)
+ GHC can dump its optimized intermediate code (said to be in “Core” format)
to a file as a side-effect of compilation. Non-GHC back-end tools can read and process Core files; these files have the suffix
.hcr. The Core format is described in
- An External Representation for the GHC Core Language,
+ An External Representation for the GHC Core Language,
and sample tools
for manipulating Core files (in Haskell) are available in the
extcore package on Hackage. Note that the format of .hcr
- files is different from the Core output format that GHC generates
+ files is different from the Core output format that GHC generates
for debugging purposes (), though the two formats appear somewhat similar.The Core format natively supports notes which you can add to