
Running 6.8.1 on Windows XP, typing 'main' while ":r" is still processing causes the 'm' in 'main' to morph to a 'g'.
:r [1 of 2] Compiling Language.QidlTypeLibrary.Parser ( Language/QidlTypeLibrary/Parser.hs, interpreted ) Ok, modules loaded: Main, Language.QidlTypeLibrary.Parser. main
<interactive>:1:0: Not in scope: `gain' Thanks, Greg

On Nov 21, 2007 1:07 PM, Greg Fitzgerald
Running 6.8.1 on Windows XP, typing 'main' while ":r" is still processing causes the 'm' in 'main' to morph to a 'g'.
:r [1 of 2] Compiling Language.QidlTypeLibrary.Parser ( Language/QidlTypeLibrary/Parser.hs, interpreted ) Ok, modules loaded: Main, Language.QidlTypeLibrary.Parser. main
<interactive>:1:0: Not in scope: `gain'
Thanks, Greg
What a weird bug. It sounds like a joke but it isn't one. I just reproduced it (also "works" with :l). P:\5. Tools\Cleansing\CustomerMaster>ghci GHCi, version 6.8.1: http://www.haskell.org/ghc/ :? for help Loading package base ... linking ... done. Prelude> :l CustomerMaster.hs [1 of 1] Compiling Main ( CustomerMaster.hs, interpreted ) Ok, modules loaded: Main. *Main> main <interactive>:1:0: Not in scope: `gain' I wonder if it's a Windows only bug. Cheers, Olivier.

On Wed, Nov 21, 2007 at 01:16:34PM -0500, Olivier Boudry wrote:
On Nov 21, 2007 1:07 PM, Greg Fitzgerald
wrote: Running 6.8.1 on Windows XP, typing 'main' while ":r" is still processing causes the 'm' in 'main' to morph to a 'g'.
:r [1 of 2] Compiling Language.QidlTypeLibrary.Parser ( Language/QidlTypeLibrary/Parser.hs, interpreted ) Ok, modules loaded: Main, Language.QidlTypeLibrary.Parser. main
<interactive>:1:0: Not in scope: `gain'
Thanks, Greg
What a weird bug. It sounds like a joke but it isn't one. I just reproduced it (also "works" with :l).
P:\5. Tools\Cleansing\CustomerMaster>ghci GHCi, version 6.8.1: http://www.haskell.org/ghc/ :? for help Loading package base ... linking ... done. Prelude> :l CustomerMaster.hs [1 of 1] Compiling Main ( CustomerMaster.hs, interpreted ) Ok, modules loaded: Main. *Main> main
<interactive>:1:0: Not in scope: `gain'
I wonder if it's a Windows only bug.
It's very old. http://hackage.haskell.org/trac/ghc/ticket/831 Stefan

Greg Fitzgerald wrote:
Running 6.8.1 on Windows XP, typing 'main' while ":r" is still processing causes the 'm' in 'main' to morph to a 'g'.
Olivier Boudry wrote:
it (also "works" with :l).
Stefan O'Rear wrote:
It's very old. http://hackage.haskell.org/trac/ghc/ticket/831
But these observations indicate several clues that do not yet appear in the Trac ticket: 1. Occurs on Windows (I can't reproduce it in on Mac OS X Intel or Debian Lenny) 2. Occurs also with :r and :l, not just evaluating an expression. Perhaps someone with with a Trac login should make note of them. -Yitz

On Thu, Nov 22, 2007 at 01:12:16AM +0200, Yitzchak Gale wrote:
Greg Fitzgerald wrote:
Running 6.8.1 on Windows XP, typing 'main' while ":r" is still processing causes the 'm' in 'main' to morph to a 'g'.
Olivier Boudry wrote:
it (also "works" with :l).
Stefan O'Rear wrote:
It's very old. http://hackage.haskell.org/trac/ghc/ticket/831
But these observations indicate several clues that do not yet appear in the Trac ticket:
1. Occurs on Windows (I can't reproduce it in on Mac OS X Intel or Debian Lenny)
That *is* in the ticket - look at the Operating System field.
2. Occurs also with :r and :l, not just evaluating an expression.
Personally I think that this is the least relatively suprising behavior, and it would be most noteworthy if it only affected expressions. But others may disagree.
Perhaps someone with with a Trac login should make note of them.
You have one! User 'guest', password 'guest'. In fact, it says this at the bottom of every page! (Spammers are smart enough to try and create accounts, but can't read page footers - go figure). Remember to sign your comment with contact info. Stefan

On Wed, Nov 21, 2007 at 05:11:05PM -0800, Stefan O'Rear wrote:
Perhaps someone with with a Trac login should make note of them.
You have one! User 'guest', password 'guest'. In fact, it says this at the bottom of every page! (Spammers are smart enough to try and create accounts, but can't read page footers - go figure).
Remember to sign your comment with contact info.
You can register new accounts nowadays, so you don't have to remember to sign everything. Thanks Ian

Quoth InteractiveUI.runGHCi: case maybe_expr of Nothing -> do #if defined(mingw32_HOST_OS) -- The win32 Console API mutates the first character of -- type-ahead when reading from it in a non-buffered manner. Work -- around this by flushing the input buffer of type-ahead characters, -- but only if stdin is available. flushed <- io (IO.try (GHC.ConsoleHandler.flushConsole stdin)) case flushed of Left err | isDoesNotExistError err -> return () | otherwise -> io (ioError err) Right () -> return () #endif -- enter the interactive loop interactiveLoop is_tty show_prompt Could this be related somehow? -Yitz

Yitzchak Gale wrote:
Quoth InteractiveUI.runGHCi:
case maybe_expr of Nothing -> do #if defined(mingw32_HOST_OS) -- The win32 Console API mutates the first character of -- type-ahead when reading from it in a non-buffered manner. Work -- around this by flushing the input buffer of type-ahead characters, -- but only if stdin is available. flushed <- io (IO.try (GHC.ConsoleHandler.flushConsole stdin)) case flushed of Left err | isDoesNotExistError err -> return () | otherwise -> io (ioError err) Right () -> return () #endif -- enter the interactive loop interactiveLoop is_tty show_prompt
Could this be related somehow?
This was a hack to work around similar behaviour when starting up GHCi, and hence Sigbjorn's comment on #831: "that's right; I did add a workaround in the end, see comments in ghci/InteractiveUI.hs:runGHCi. It's in both STABLE and HEAD; dunno if it scratches this particular itch though. Notice that my workaround is only applied upon startup, not in the REPL. => floating the hackery inward could just save the day. " The underlying bug is in the Windows CRT, or perhaps a deeper level. IIRC it exists on a bug tracker somewhere inside Microsoft... Cheers, Simon

Sigbjorn wrote:
This was a hack to work around similar behaviour when starting up GHCi, Notice that my workaround is only applied upon startup, not in the REPL. => floating the hackery inward could just save the day. "
OK. Simon Marlow wrote:
The underlying bug is in the Windows CRT, or perhaps a deeper level.
Perhaps. But eval-print loop shells in other languages do not seem to exhibit this problem afaik, so there must be some way to do it. E.g., glancing through the source code of the Python interpreter, they don't seem to do anything special. They flush like we do, and they set O_BINARY, and that's about it I think. Unless I missed something. Regards, Yitz
participants (6)
-
Greg Fitzgerald
-
Ian Lynagh
-
Olivier Boudry
-
Simon Marlow
-
Stefan O'Rear
-
Yitzchak Gale