@@ -346,7 +346,7 @@ partial
346346printLn : Show a => a -> IO' ffi ()
347347printLn x = putStrLn (show x)
348348
349−||| Read one line of input from stdin
349+||| Read one line of input from stdin, without the trailing newline
350350partial
351351getLine : IO' ffi String
352352getLine = prim_read
@@ -545,5 +545,7 @@ readFile fn = do h <- openFile fn Read
545545 readFile' h contents =
546546 do x <- feof h
547547 if not x then do l <- fread h
548− readFile' h (contents ++ l)
548+ case contents of
549+ "" => readFile' h l
550+ _ => readFile' h (contents ++ "\n" ++ l)
549551 else return contents