X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fdocs%2Fusers_guide%2Fghci.sgml;h=cd82849f60e70e53b12cfb4999ab5abf21b5a375;hb=2dfd507259664e6f28df4a9467a8de34d01d70a0;hp=792f68b68f6505d0b4269af70bf92b9163fa7bb1;hpb=dc801dc275fb8f81d482535b4d6317e234bb10f8;p=ghc-hetmet.git diff --git a/ghc/docs/users_guide/ghci.sgml b/ghc/docs/users_guide/ghci.sgml index 792f68b..cd82849 100644 --- a/ghc/docs/users_guide/ghci.sgml +++ b/ghc/docs/users_guide/ghci.sgml @@ -146,7 +146,7 @@ Ok, modules loaded: Main. indicate that the current context for expressions typed at the prompt is the Main module we just loaded (we'll explain what the * means later in ). So we can now type expressions involving + linkend="ghci-scope"/>). So we can now type expressions involving the functions from Main.hs: @@ -191,13 +191,13 @@ Ok, modules loaded: Main. or it can be set using the :set command from within GHCi (see )Note that in + linkend="ghci-cmd-line-options"/>)Note that in GHCi, and mode, the option is used to specify the search path for source files, whereas in standard batch-compilation mode the option is used to specify the search path for interface files, see . + linkend="search-path"/>. One consequence of the way that GHCi follows dependencies to find modules to load is that every module must have a source @@ -220,7 +220,7 @@ Ok, modules loaded: Main. doing its best to avoid actually recompiling modules if their external dependencies haven't changed. This is the same mechanism we use to avoid re-compiling modules in the batch - compilation setting (see ). + compilation setting (see ). @@ -247,7 +247,7 @@ Ok, modules loaded: Main. use one in preference to interpreting the source if possible. For example, suppose we have a 4-module program consisting of modules A, B, C, and D. Modules B and C both import D only, - and A imports both B & C: + and A imports both B & C: A / \ @@ -522,12 +522,12 @@ Prelude,IO> Here's an example: -Prelude> x <- return 42 +Prelude> x <- return 42 Prelude> print x 42 Prelude> - The statement x <- return 42 means + The statement x <- return 42 means “execute return 42 in the IO monad, and bind the result to x”. We can then use @@ -543,7 +543,7 @@ Prelude> print x Prelude> An important difference between the two types of binding - is that the monadic bind (p <- e) is + is that the monadic bind (p <- e) is strict (it evaluates e), whereas with the let form, the expression isn't evaluated immediately: @@ -629,7 +629,7 @@ Wed Mar 14 12:23:13 GMT 2001 The corresponding translation for an IO-typed e is - it <- e + it <- e @@ -678,7 +678,7 @@ Wed Mar 14 12:23:13 GMT 2001 instructs GHCi to load the specified modules or filenames (and all the modules they depend on), just as if you had said :load modules at the - GHCi prompt (see ). For example, to + GHCi prompt (see ). For example, to start GHCi and load the program whose topmost module is in the file Main.hs, we could say: @@ -687,7 +687,7 @@ $ ghci Main.hs Most of the command-line options accepted by GHC (see ) also make sense in interactive mode. The ones + linkend="using-ghc"/>) also make sense in interactive mode. The ones that don't make sense are mostly obvious; for example, GHCi doesn't generate interface files, so options related to interface file generation won't have any effect. @@ -696,7 +696,7 @@ $ ghci Main.hs Packages packageswith GHCi - Most packages (see ) are + Most packages (see ) are available without needing to specify any extra flags at all: they will be automatically loaded the first time they are needed. @@ -744,7 +744,7 @@ Prelude> :set -package name the normal -llib option. (The term library here refers to libraries of foreign object code; for using libraries of Haskell - source code, see .) For + source code, see .) For example, to load the “m” library: @@ -782,7 +782,7 @@ $ ghci -lm Ordering of options matters: a library should be mentioned before the libraries it - depends on (see ). + depends on (see ). @@ -875,7 +875,7 @@ $ ghci -lm That's all a little confusing, so here's a few examples. To start with, here's a new GHCi command which doesn't take any arguments or produce any results, it just - outputs the current date & time: + outputs the current date & time: Prelude> let date _ = Time.getClockTime >>= print >> return "" @@ -975,7 +975,7 @@ Prelude> :def make (\_ -> return ":! ghc ––make Main") :module Sets or modifies the current context for statements - typed at the prompt. See for + typed at the prompt. See for more details. @@ -1005,7 +1005,7 @@ Prelude> :def make (\_ -> return ":! ghc ––make Main") :set option... :set - Sets various options. See + Sets various options. See for a list of available options. The :set command by itself shows which options are currently set. @@ -1088,7 +1088,7 @@ Prelude> :def make (\_ -> return ":! ghc ––make Main") :unset option... :unset - Unsets certain options. See + Unsets certain options. See for a list of available options. @@ -1192,7 +1192,7 @@ Prelude> :set -fglasgow-exts Any GHC command-line option that is designated as dynamic (see the table in ), may be set using + linkend="flag-reference"/>), may be set using :set. To unset an option, you can set the reverse option: dynamicoptions @@ -1201,7 +1201,7 @@ Prelude> :set -fglasgow-exts Prelude> :set -fno-glasgow-exts - lists the reverse for each + lists the reverse for each option where applicable. Certain static options (,