开发者

haskell putStr outputs extra newlines

main = do
       file_name <- getLine
       text <- readFile file_name
       let b = prepare $ line text
       let 开发者_如何学运维x = sth b
       mapM_ (putStr . print_matrix . fst ) x

When I ran this code I got:

1 2 3

4 5 6

7 8 9

9 2 1

1 1 1

1 1 1

But in random lines I got extra newlines. When I wrote 300 lines I got 2 extra random newlines.

9 2 1

(extra enter)

1 1 1

1 1 1


I'm pretty sure putStr is printing the newlines read in from the file, unless prepare or sth is chopping them off.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜