summaryrefslogtreecommitdiff
path: root/testsuite/tests/lib/IO/hGetLine002.hs
blob: 5c08b716d1f5a8347eb160295a7689dc9e2668b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
-- !!! testing hGetLine on a file without a final '\n'.

-- According to the Haskell 98 report, getLine should discard a line without a
-- closing newline character (see implementation of getLine). 
--
-- However, we don't believe that this is the right behaviour.

import System.IO

main = catch loop (\e -> print e)

loop = do 
  hSetBuffering stdin LineBuffering
  l <- hGetLine stdin
  putStrLn l
  loop