X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=docs%2Fusers_guide%2Fusing.xml;h=c12f76b7c7810b610af8e6c2061d60c5b659d9a7;hp=2503acebd49551b04513de9c966f54d38cc64a5e;hb=da3ab5cd1dfea1415e78404510e3acbff8759413;hpb=559a5553ca80955393365335903237bec2e7a583 diff --git a/docs/users_guide/using.xml b/docs/users_guide/using.xml index 2503ace..c12f76b 100644 --- a/docs/users_guide/using.xml +++ b/docs/users_guide/using.xml @@ -73,10 +73,9 @@ module X where maintains internally, so you'll be desperately disappointed if you try to glob etc. inside OPTIONS_GHC. - NOTE: the contents of OPTIONS_GHC are prepended to the - command-line options, so you do have the - ability to override OPTIONS_GHC settings via the command - line. + NOTE: the contents of OPTIONS_GHC are appended to the + command-line options, so options given in the source file + override those given on the command-line. It is not recommended to move all the contents of your Makefiles into your source files, but in some circumstances, the @@ -343,6 +342,44 @@ module X where + ghc --show-iface file + + + + + Read the interface in + file and dump it as text to + stdout. For example ghc --show-iface M.hi. + + + + + + + ghc --supported-languages + + + + + Print the supported language extensions. + + + + + + + ghc --info + + + + + Print information about the compiler. + + + + + + ghc --version ghc -V @@ -601,7 +638,7 @@ ghc -c Foo.hs Overriding the default behaviour for a file As described above, the way in which a file is processed by GHC - depends on its suffix. This behaviour can be overriden using the + depends on its suffix. This behaviour can be overridden using the option: @@ -819,6 +856,7 @@ ghc -c Foo.hs -W option Provides the standard warnings plus , + , , , and . @@ -826,28 +864,27 @@ ghc -c Foo.hs - : - - - Turns off all warnings, including the standard ones. - - - - : Turns on all warning options that indicate potentially suspicious code. The warnings that are not enabled by - are: - - - - - - - + are + , + , + , + , and + . + + + + + : + + + Turns off all warnings, including the standard ones and + those that -Wall doesn't enable. @@ -860,6 +897,16 @@ ghc -c Foo.hs + + : + + + Warnings are treated only as warnings, not as errors. This is + the default, but can be useful to negate a + flag. + + + The full set of warning options is described below. To turn @@ -878,6 +925,20 @@ ghc -c Foo.hs function or type is used. Entities can be marked as deprecated using a pragma, see . + + This option is on by default. + + + + + : + + + + Causes a warning to be emitted when a a datatype + T is imported + with all constructors, i.e. T(..), but has been + exported abstractly, i.e. T. @@ -954,7 +1015,7 @@ ghc -c Foo.hs g [] = 2 - This option isn't enabled be default because it can be + 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. @@ -982,7 +1043,7 @@ f :: Foo -> Foo f foo = foo { x = 6 } - This option isn't enabled be default because it can be + This option isn't enabled by default because it can be very noisy, and it often doesn't indicate a bug in the program. @@ -1055,12 +1116,8 @@ f foo = foo { x = 6 } inner-scope value has the same name as an outer-scope value, i.e. the inner value shadows the outer one. This can catch typographical errors that turn into hard-to-find bugs, e.g., - in the inadvertent cyclic definition let x = ... x - ... in. - - Consequently, this option - will complain about cyclic recursive - definitions. + in the inadvertent capture of what would be a recursive call in + f = ... let f = id in ... f .... @@ -1073,7 +1130,7 @@ f foo = foo { x = 6 } This option causes a warning to be emitted whenever the module contains an "orphan" instance declaration or rewrite rule. - An instance declartion is an orphan if it appears in a module in + An instance declaration is an orphan if it appears in a module in which neither the class nor the type being instanced are declared in the same module. A rule is an orphan if it is a rule for a function declared in another module. A module containing any @@ -1094,7 +1151,7 @@ f foo = foo { x = 6 } By default, the compiler will warn you if a set of - patterns are overlapping, i.e., + patterns are overlapping, e.g., f :: String -> Int @@ -1119,7 +1176,7 @@ f "2" = 2 patterns that can fail, eg. \(x:xs)->.... Normally, these aren't treated as incomplete patterns by . - ``Lambda-bound patterns'' includes all places where there is a single pattern, + “Lambda-bound patterns” includes all places where there is a single pattern, including list comprehensions and do-notation. In these cases, a pattern-match failure is quite legitimate, and triggers filtering (list comprehensions) or the monad fail operation (monads). For example: @@ -1129,10 +1186,6 @@ f "2" = 2 Switching on will elicit warnings about these probably-innocent cases, which is why the flag is off by default. - The deriving( Read ) mechanism produces monadic code with - pattern matches, so you will also get misleading warnings about the compiler-generated - code. (This is arguably a Bad Thing, but it's awkward to fix.) - @@ -1157,7 +1210,7 @@ f "2" = 2 the Haskell defaulting mechanism for numeric types kicks in. This is useful information when converting code from a context that assumed one default into one with another, - e.g., the `default default' for Haskell 1.4 caused the + e.g., the ‘default default’ for Haskell 1.4 caused the otherwise unconstrained value 1 to be given the type Int, whereas Haskell 98 defaults it to Integer. This may lead to @@ -1549,24 +1602,6 @@ f "2" = 2 - - - - - Switches on an experimental "optimisation". - Switching it on makes the compiler a little keener to - inline a function that returns a constructor, if the - context is that of a thunk. - - x = plusInt a b - - If we inlined plusInt we might get an opportunity to use - update-in-place for the thunk 'x'. - - - - - : inlining, controlling @@ -1669,7 +1704,7 @@ f "2" = 2 is also possible to obtain performance improvements with parallelism on programs that do not use concurrency. This section describes how to use GHC to compile and run parallel programs, in we desribe the language features that affect + linkend="lang-parallel" /> we describe the language features that affect parallelism. @@ -1771,16 +1806,15 @@ statements or clauses. intermediate code generation GHC can dump its optimized intermediate code (said to be in “Core” format) - to a file as a side-effect of compilation. Core files, which are given the suffix - .hcr, can be read and processed by non-GHC back-end - tools. The Core format is formally described in + 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, - and sample tools (in Haskell) - for manipulating Core files are available in the GHC source distribution - directory /fptools/ghc/utils/ext-core. + and sample tools + for manipulating Core files (in Haskell) are in the GHC source distribution + directory under utils/ext-core. Note that the format of .hcr - files is different (though similar) to the Core output format generated - for debugging purposes (). + 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 your source code using the CORE pragma (see -GHC can also read in External Core files as source; just give the .hcr file on -the command line, instead of the .hs or .lhs Haskell source. -A current infelicity is that you need to give the -fglasgow-exts flag too, because -ordinary Haskell 98, when translated to External Core, uses things like rank-2 types. +Currently (as of version 6.8.2), GHC does not have the ability to read in External Core files as source. If you would like GHC to have this ability, please make your wishes known to the GHC Team. + &debug;