on master help sign in
Fix readFile implementation
d2074d8Mort Yao
libs/prelude/Prelude.idr+3−1
@@ -545,5 +545,7 @@ readFile fn = do h <- openFile fn Read
545 readFile' h contents =
545 readFile' h contents =
546 do x <- feof h
546 do x <- feof h
547 if not x then do l <- fread h
547 if not x then do l <- fread h
548+ case contents of
549+ "" => readFile' h l
548− readFile' h (contents ++ l)
550+ _ => readFile' h (contents ++ "\n" ++ l)
549 else return contents
551 else return contents