X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=docs%2Fusers_guide%2Fghci.xml;h=aaa9c460931aaebe4af10f9366fb8405e30d2b95;hb=708aa86d707f71db9430d41b4e8188c030012597;hp=06eb348bfb562b1b58275c992e66708befde9c70;hpb=1f28aaa6116d9cb90966b1bb6cdcbe52fe938867;p=ghc-hetmet.git diff --git a/docs/users_guide/ghci.xml b/docs/users_guide/ghci.xml index 06eb348..aaa9c46 100644 --- a/docs/users_guide/ghci.xml +++ b/docs/users_guide/ghci.xml @@ -1244,9 +1244,9 @@ li - (_t1::[Maybe Integer]) Prelude> head li Just 1 Prelude> :sp li -li - [Just 1 | _] +li - Just 1 : _ Prelude> :p li -li - [Just 1 | (_t2::[Maybe Integer])] +li - Just 1 : (_t2::[Maybe Integer]) Prelude> last li Just 5 Prelude> :sp li @@ -1262,8 +1262,6 @@ li - [Just 1,(_t6::Maybe Integer),Just 3,(_t7::Maybe Integer),Just 4] to help us observe how the li variable is evaluated progressively as we operate with it. Note for instance how last traverses all the elements of the list to compute its result, but without evaluating the individual elements. - Finally note that the Prolog convention of [head | tail] is used by - :sprint to display unevaluated lists. @@ -1389,7 +1387,7 @@ li - _ Prelude> head li Just 1 Prelude> :sp li -li - [Just 1 | _] +li - Just 1 : _ Prelude> last li Just 5 Prelude> :sp li @@ -1398,8 +1396,6 @@ li - [Just 1,_,_,_,Just 5] The example uses :sprint to help us observe how the li variable is evaluated progressively as we operate with it. Note for instance how last traverses all the elements of the list to compute its result, but without evaluating the individual elements. - Finally note that the Prolog convention of [head | tail] is used by - :sprint to display unevaluated lists. @@ -1880,7 +1876,7 @@ Main.hs:15> x' Note that a wrong coercion will likely result in your debugging session being interrupted by a segmentation fault - * The undocumented (and unsupported) :force command + * The :force command equivalent to :print with automatic seq forcing, @@ -1952,6 +1948,32 @@ Main.hs:15> x' + + Compiling to object code inside GHCi + + By default, GHCi compiles Haskell source code into byte-code + that is interpreted by the runtime system. GHCi can also compile + Haskell code to object code: to turn on this feature, use the + flag either on the command line or + with :set (the option + restores byte-code compilation + again). Compiling to object code takes longer, but typically the + code will execute 10-20 times faster than byte-code. + + Compiling to object code inside GHCi is particularly useful + if you are developing a compiled application, because the + :reload command typically runs much faster than + restarting GHC with from the command-line, + because all the interface files are already cached in + memory. + + There are disadvantages to compiling to object-code: you + can't set breakpoints in object-code modules, for example. Only + the exports of an object-code module will be visible in GHCi, + rather than all top-level bindings as in interpreted + modules. + + FAQ and Things To Watch Out For