X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fdocs%2Fusers_guide%2Fusing.vsgml;h=e6f6e9be56593f9001ecf819430177ec44afd740;hb=0e24544c6c180bce89fbf852f6421a7c4b58cab8;hp=254eb0d362785c95ef5871c20e67b9988adc7a3c;hpb=abdd55c9c4a2873c2f4b25b4ea54ca921bca4f5e;p=ghc-hetmet.git diff --git a/ghc/docs/users_guide/using.vsgml b/ghc/docs/users_guide/using.vsgml index 254eb0d..e6f6e9b 100644 --- a/ghc/docs/users_guide/using.vsgml +++ b/ghc/docs/users_guide/using.vsgml @@ -228,7 +228,7 @@ If you would like to look at the assembler output, toss in a standard error, saving Sometimes, you may cause GHC to be rather chatty on standard error; -with @-fshow-import-specs@, for example. You can instruct GHC to +with @-dshow-rn-trace@, for example. You can instruct GHC to append this output to a particular log file with a @-odump @-odump <blah> option option. @@ -265,7 +265,7 @@ GHC has a number of options that select which types of non-fatal error messages, otherwise known as warnings, can be generated during compilation. By default, you get a standard set of warnings which are generally likely to indicate bugs in your program. These are: -@-fwarn-overlpapping-patterns@, @-fwarn-duplicate-exports@, and +@-fwarn-overlapping-patterns@, @-fwarn-duplicate-exports@, and @-fwarn-missing-methods@. The following flags are simple ways to select standard ``packages'' of warnings: @@ -284,8 +284,8 @@ Synonym for @-Wnot@. @-W@: -W option -Provides the standard warnings plus @-fwarn-incomplete-patterns@ -and @-fwarn-unused-names@. +Provides the standard warnings plus @-fwarn-incomplete-patterns@, +@-fwarn-unused-imports@ and @-fwarn-unused-binds@. @-Wall@: -Wall option @@ -313,6 +313,16 @@ into hard-to-find bugs, e.g., in the inadvertent cyclic definition Consequently, this option does not allow cyclic recursive definitions. +@-fwarn-hi-shadowing@: +-fwarn-hi-shadowing option +interface files, shadowing + +Warns you about shadowing of interface files along the supplied import path. +For instance, assuming you invoke @ghc@ with the import path +@-iutils:src@ and @Utils.hi@ exist in both the @utils@ and @src@ +directories, @-fwarn-hi-shadowing@ will warn you that @utils/Utils.hi@ +shadows @src/Utils.hi@. + @-fwarn-overlapping-patterns@: -fwarn-overlapping-patterns option overlapping patterns, warning @@ -353,12 +363,31 @@ This option is on by default, and warns you whenever an instance declaration is missing one or more methods, and the corresponding class declaration has no default declaration for them. -@-fwarn-unused-names@: --fwarn-unused-names option -unused names, warning -names, unused +@-fwarn-unused-imports@: +-fwarn-unused-imports option +unused imports, warning +imports, unused + +Report any objects that are explicitly imported but never used. + +@-fwarn-unused-binds@: +-fwarn-unused-binds option +unused binds, warning +binds, unused + +Report any function definitions (and local bindings) which are unused. +For top-level functions, the warning is only given if the binding is +not exported. -Have the renamer report which locally defined names are not used/exported. +@-fwarn-unused-matches@: +-fwarn-unused-matches option +unused matches, warning +matches, unused + +Report all unused variables which arise from pattern matches, +including patterns consisting of a single variable. For instance @f x +y = []@ would report @x@ and @y@ as unused. To eliminate the warning, +all unused variables can be replaced with wildcards. @-fwarn-duplicate-exports@: -fwarn-duplicate-exports option @@ -457,26 +486,40 @@ In your program, you import a module @Foo@ by saying It has a builtin list of directories (notably including @.@) where it looks. -The @-i@ option-i<dirs> option prepends a -colon-separated list of @dirs@ to the ``import directories'' list. + + +@-i@-i<dirs> option This flag +prepends a colon-separated list of @dirs@ to the ``import +directories'' list. + +@-i@ resets the ``import directories'' list back to nothing. + +@-fno-implicit-prelude@ +-fno-implicit-prelude option +GHC normally imports @Prelude.hi@ files for you. If you'd rather it +didn't, then give it a @-fno-implicit-prelude@ option. You are +unlikely to get very far without a Prelude, but, hey, it's a free +country. -A plain @-i@ resets the ``import directories'' list back to nothing. +@-syslib @ +-syslib <lib> option -GHC normally imports @Prelude.hi@ files for you. If you'd rather -it didn't, then give it a @-fno-implicit-prelude@ -option-fno-implicit-prelude option. You are unlikely to get -very far without a Prelude, but, hey, it's a free country. +If you are using a system-supplied non-Prelude library (e.g., the +POSIX library), just use a @-syslib posix@ option (for example). The +right interface files should then be available. Section lists the +libraries available by this mechanism. -If you are using a system-supplied non-Prelude library (e.g., the HBC -library), just use a @-syslib hbc@-syslib <lib> option -option (for example). The right interface files should then be -available. +@-I@ +-I<dir> option Once a Haskell module has been compiled to C (@.hc@ file), you may -wish to specify where GHC tells the C compiler to look for @.h@ -files. (Or, if you are using the @-cpp@ option-cpp option, -where it tells the C pre-processor to look...) For this purpose, use -a @-I@-I<dir> option in the usual C-ish way. +wish to specify where GHC tells the C compiler to look for @.h@ files. +(Or, if you are using the @-cpp@ option-cpp option, where +it tells the C pre-processor to look...) For this purpose, use a @-I@ +option in the usual C-ish way. + + %************************************************************************ %* * @@ -523,8 +566,9 @@ turned off with @-fno-prune-tydecls@ and @-fno-prune-instdecls@. -fno-prune-tydecls option-fno-prune-instdecls option -See also Section , which describes how the linker -finds standard Haskell libraries. +See also Section , which describes how the linker finds standard +Haskell libraries. %************************************************************************ %* * @@ -638,19 +682,22 @@ a rule to do so; one of the preceding suffix rules does the job nicely. Putting inter-dependencies of the form @Foo.o : Bar.hi@ into your -@Makefile@ by hand is rather error-prone. Don't worry---never fear, -@mkdependHS@ is here! (and is distributed as part of GHC) Add the -following to your @Makefile@: +@Makefile@ by hand is rather error-prone. @ghc@ offers you a helping +hand with it's @-M@ option. To automatically generate +inter-dependencies, add the following to your @Makefile@: depend : - mkdependHS -- $(HC_OPTS) -- $(SRCS) + $(HC) -M $(HC_OPTS) $(SRCS) Now, before you start compiling, and any time you change the @imports@ in your program, do @make depend@ before you do @make cool_pgm@. -@mkdependHS@ will append the needed dependencies to your @Makefile@. -@mkdependHS@ is fully describe in Section . A few caveats about this simple scheme: @@ -671,6 +718,90 @@ again, it may take multiple iterations to ``settle.'' %************************************************************************ %* * +How to compile mutually recursive modules +