[project @ 2000-06-14 10:08:47 by simonmar]
authorsimonmar <unknown>
Wed, 14 Jun 2000 10:08:47 +0000 (10:08 +0000)
committersimonmar <unknown>
Wed, 14 Jun 2000 10:08:47 +0000 (10:08 +0000)
Fix mondo bogosity in hGetLine, probably caused by cut-n-pasting with eyes shut.

ghc/lib/std/PrelIO.lhs

index dc56a7e..f500692 100644 (file)
@@ -140,12 +140,12 @@ hGetChar handle = do
 
 hGetLine :: Handle -> IO String
 hGetLine h = do
-    buffer_mode <- wantWriteableHandle_ "hGetLine" h
-                       (\ handle_ -> do getBuffer handle_)
+    buffer_mode <- wantReadableHandle "hGetLine" h
+                       (\ handle_ -> do return (haBufferMode__ handle_))
     case buffer_mode of
-       (NoBuffering, _, _)          -> hGetLineUnBuffered h
-       (LineBuffering, buf, bsz)    -> hGetLineBuf' []
-       (BlockBuffering _, buf, bsz) -> hGetLineBuf' []
+       NoBuffering      -> hGetLineUnBuffered h
+       LineBuffering    -> hGetLineBuf' []
+       BlockBuffering _ -> hGetLineBuf' []
 
   where hGetLineBuf' xss = do
           (eol, xss) <- catch