@@ -352,7 +352,13 @@ printLn x = putStrLn (show x)
352||| Read one line of input from stdin, without the trailing newline
352||| Read one line of input from stdin, without the trailing newline
354getLine : IO' ffi String
354getLine : IO' ffi String
355−getLine = prim_read
355+getLine = do x <- prim_read
356+ return (reverse (trimNL (reverse x)))
357+ where trimNL : String -> String
358+ trimNL str with (strM str)
359+ trimNL "" | StrNil = ""
360+ trimNL (strCons '\n' xs) | StrCons _ _ = xs
361+ trimNL (strCons x xs) | StrCons _ _ = strCons x xs
357||| Write a single character to stdout
363||| Write a single character to stdout
@@ -548,7 +554,5 @@ readFile fn = do h <- openFile fn Read
548 readFile' h contents =
554 readFile' h contents =
549 do x <- feof h
555 do x <- feof h
550 if not x then do l <- fread h
556 if not x then do l <- fread h
553− _ => readFile' h (contents ++ "\n" ++ l)
557+ readFile' h (contents ++ l)
554 else return contents
558 else return contents