Opened 7 years ago

Closed 7 years ago

Last modified 6 years ago

#1354 closed bug (duplicate)

Interactive I/O with ghc doesn't prompt until after reading

Reported by: ok@… Owned by:
Priority: normal Milestone:
Component: Prelude Version: 6.2
Keywords: interactive stdio late prompt Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:

Description

My students complained that the interactive program they were to write using
Haskell would not issue its first prompt until after the first line of input
had been entered. I enclose a tiny Haskell program that exhibits this
behaviour in 6.2 (SPARC Solaris) and 6.4 (Intel Linux) and am told that it
also happens in 6.6. I also show that it works fine in Hugs, HBC, and NCH98.
Script started on Tue 15 May 2007 02:11:26 PM NZST
f% cat -n kcl.hs

1 main =
2 putStr "Enter a line:" >>
3 putChar ' ' >>
4 getLine >>= \a ->
5 putStrLn a >>
6 putStrLn a

f% uname -a
SunOS frege 5.9 Generic_112233-04 sun4u sparc SUNW,Sun-Blade-100

f% hugs98
[snip]

Version: February 2001 _

Haskell 98 mode: Restart with command line option -98 to enable extensions
Reading file "/home/users/okeefe_r/quasar/hugs98/shared/hugs/lib/Prelude.hs":
[snip]
Prelude> :load kcl
Reading file "kcl.hs":

[snip]
kcl.hs
Main> main
Enter a line: Foo!
Foo!
Foo!

Main> [Leaving Hugs]

f% rm a.out
f% nhc98 -o a.out kcl.hs
f% a.out
Enter a line: Foo!
Foo!
Foo!

f% rm a.out
f% hbc -o a.out kcl.hs
f% a.out
Enter a line: Foo!
Foo!
Foo!

f% rm a.out
f% ghc --version
The Glorious Glasgow Haskell Compilation System, version 6.2
f% ghc kcl.hs
f% a.out
Foo!
Enter a line: Foo!
Foo!

f% ftp kcl.hs to bling?
f% ssh bling
[snip]
b% uname -a
Linux oucs816.otago.ac.nz 2.6.19-1.2911.fc6 #1 SMP Sat Feb 10 15:51:47 EST 2007 i686 i686 i386 GNU/Linux
b% hugs
b% hugs
[snip]

Version: November 2002 _

[snip]
Prelude> :load kcl
Reading file "kcl.hs":

Hugs session for:
/usr/local/lib/hugs/lib/Prelude.hs
kcl.hs
Main> main
Enter a line: Bar!
Bar!
Bar!

Main> [Leaving Hugs]

b% rm a.out
b% ghc --version
The Glorious Glasgow Haskell Compilation System, version 6.4
b% ghc kcl.hs
b% ./a.out
Bar!
Enter a line: Bar!
Bar!

Change History (3)

comment:1 Changed 7 years ago by simonmar

  • Resolution set to duplicate
  • Status changed from new to closed

dup of #1355

comment:2 Changed 6 years ago by simonmar

  • Architecture changed from Multiple to Unknown/Multiple

comment:3 Changed 6 years ago by simonmar

  • Operating System changed from Multiple to Unknown/Multiple
Note: See TracTickets for help on using tickets.