X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=docs%2Fusers_guide%2Fghci.xml;h=6e54ace77898c915a4d9acce5138bfc36f909524;hb=df47ef3b970bc9ff1ba4935262ebc6f5fdd0334d;hp=402c7cb58c99394357bc5842f076708aa5f6ca0f;hpb=3d73e45b0909b9669d4679cbda29fa2b17b98d2e;p=ghc-hetmet.git diff --git a/docs/users_guide/ghci.xml b/docs/users_guide/ghci.xml index 402c7cb..6e54ace 100644 --- a/docs/users_guide/ghci.xml +++ b/docs/users_guide/ghci.xml @@ -28,8 +28,11 @@ $ ghci -GHCi, version 6.8.1: http://www.haskell.org/ghc/ :? for help +GHCi, version 6.12.1: http://www.haskell.org/ghc/ :? for help +Loading package ghc-prim ... linking ... done. +Loading package integer-gmp ... linking ... done. Loading package base ... linking ... done. +Loading package ffi-1.0 ... linking ... done. Prelude> @@ -814,12 +817,12 @@ it <- e ghci> reverse [] What should GHCi do? Strictly speaking, the program is ambiguous. show (reverse []) - (which is what GHCi computes here) has type Show a => a and how that displays depends + (which is what GHCi computes here) has type Show a => String and how that displays depends on the type a. For example: - ghci> (reverse []) :: String + ghci> reverse ([] :: String) "" - ghci> (reverse []) :: [Int] + ghci> reverse ([] :: [Int]) [] However, it is tiresome for the user to have to specify the type, so GHCi extends Haskell's type-defaulting @@ -2331,6 +2334,16 @@ bar + :run + :run + + + See :main. + + + + + :set option... :set @@ -2386,7 +2399,9 @@ bar Inside prompt, the sequence %s is replaced by the names of the modules currently in scope, and %% is - replaced by %. + replaced by %. If prompt + starts with " then it is parsed as a Haskell String; + otherwise it is treated as a literal string. @@ -2906,6 +2921,13 @@ Prelude> :set -fno-glasgow-exts because this is normally what you want in an interpreter: output appears as it is generated. + + If you want line-buffered behaviour, as in GHC, you can + start your program thus: + + main = do { hSetBuffering stdout LineBuffering; ... } + +