[GHC] #7583: IO reordering

GHC cvs-ghc at haskell.org
Tue Jan 15 12:18:58 CET 2013


#7583: IO reordering
---------------------------------------------+------------------------------
    Reporter:  Heimdell                      |        Owner:                             
        Type:  bug                           |       Status:  closed                     
    Priority:  normal                        |    Component:  Compiler                   
     Version:  7.4.1                         |   Resolution:  invalid                    
    Keywords:  IO, invalid evaluation order  |           Os:  Linux                      
Architecture:  x86_64 (amd64)                |      Failure:  Incorrect result at runtime
   Blockedby:                                |     Blocking:                             
     Related:                                |  
---------------------------------------------+------------------------------
Changes (by monoidal):

  * status:  new => closed
  * resolution:  => invalid


Comment:

 This is because GHC uses line buffering by default, while GHCi disables
 buffering. You can flush after each output or disable buffering:

 {{{
 import System.IO

 main = do hSetBuffering stdout NoBuffering
           putStr "> "
           line <- getLine
           putStrLn line
 }}}

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7583#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler



More information about the ghc-tickets mailing list