[GHC] #13440: putStr doesn't have the same behavior in GHCi and after compilation with GHC
GHC
ghc-devs at haskell.org
Fri Mar 17 17:04:58 UTC 2017
#13440: putStr doesn't have the same behavior in GHCi and after compilation with
GHC
-------------------------------------+-------------------------------------
Reporter: vanto | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.0.2
Keywords: | Operating System: Unknown/Multiple
Architecture: | Type of failure: Other
Unknown/Multiple |
Test Case: | Blocked By:
Blocking: | Related Tickets:
Differential Rev(s): | Wiki Page:
-------------------------------------+-------------------------------------
Hi,
{{{
main :: IO ()
main = do {
putStr "hello";
x <- getChar; -- or x <- getLine;
putStr "x = ";
print x;
}
}}}
the program works in GHCi and after compilation with GHC.
in GHCi it works fine but after compilation it does not work fine.
in GHCi the first line of code is evaluated the first while after
compilation
is the second line which is evaluated first.
so in GHCi we have as a result:
{{{
hellom
x = 'm'
}}}
and after compilation we have as a result:
{{{
m
hellox = 'm'
}}}
After compilation, putStr is not evaluated the first. It is getChar or
getLine.
In GHCi the behavior is correct. But after compilation the behavior is
strange.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13440>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list