From accc1381a865f51ad866e6b7c4bc927f1b7aacb7 Mon Sep 17 00:00:00 2001 From: simonmar Date: Tue, 2 Oct 2001 11:09:55 +0000 Subject: [PATCH] [project @ 2001-10-02 11:09:55 by simonmar] Add a FAQ entry about using getContents in GHCi. --- ghc/docs/users_guide/ghci.sgml | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/ghc/docs/users_guide/ghci.sgml b/ghc/docs/users_guide/ghci.sgml index a82782f..3e900c4 100644 --- a/ghc/docs/users_guide/ghci.sgml +++ b/ghc/docs/users_guide/ghci.sgml @@ -1109,8 +1109,31 @@ Prelude> :set -fno-glasgow-exts properly with GHC's concurrency model. - + + After using getContents, I can't use + stdin again until I do + :load or :reload. + + + This is the defined behaviour of + getContents: it puts the stdin Handle in + a state known as semi-closed, wherein + any further I/O operations on it are forbidden. Because I/O + state is retained between computations, the semi-closed + state persists until the next :load or + :reload command. + + You can make stdin reset itself + after every evaluation by giving GHCi the command + :set +r. This works because + stdin is just a top-level expression that + can be reverted to its unevaluated state in the same way as + any other top-level expression (CAF). + + + + -- 1.7.10.4