
On Mon, 11 Jul 2005, Dinh Tien Tuan Anh wrote:
Hi, im using Hugs 98 and learing how to use interactive Haskell. As read in the book:
capitalise :: [Char] -> [Char] capitalise = takeWhile(/='.') . map toUpper
interact capitalise
its said the program is FULLY INTERACTIVE, i.e: as soon as 'h' typed on the keyboard, an 'H' appears on the screen. But the program above always waits untill ENTER was hit to display the result
Is this normal ? Is the book right ?
Yes, it is certainly not Hugs which prevents from realtime interaction but it is the terminal you are using. If the terminal lets you delete the characters on the current line it has to keep them until you complete it with ENTER. Piping from and to other programs or files may not have this problem.