Optimisation and unsafePerformIO
David Sabel
dsabel@stud.uni-frankfurt.de
Sun, 27 Oct 2002 18:32:06 +0100
Consider the following program:
---------------------------------
{-# NOINLINE b #-}
b x = if even x then unsafePerformIO getChar else bot
bot = bot
main = do
putChar (b 4)
putChar (b 6)
-----------------------------
when you compile the programm with the options: -O0
and execute the program you get:
> test
ab (That's the input)
ab (That's the ouput)
when you compile the programm with the options: -O1 -fno-cse
you get:
> test
ab
aa
my question is now: which transformation/optimisation is responsible for
that, and is it
possible to switch off this transformation?
David Sabel