
2 May
2007
2 May
'07
11:17 a.m.
Hi Bulat,
Wednesday, May 2, 2007, 7:00:05 PM, you wrote:
{-# NOINLINE wrapIO #-} wrapIO x = unsafePerformIO (x >>= return)
-fno-cse ? it's usual company for unsafePerformIO+NOINLINE :)
No luck, alas. A slightly tweaked version, which is slightly simpler and still gives the same behaviour is below. Thanks Neil ---------------------- main = p_System_IO_hGetChar undefined `seq` p_System_IO_hGetChar 12 `seq` putStrLn "done" foreign import ccall "stdio.h getchar" getchar :: IO Word8 {-# NOINLINE p_System_IO_hGetChar #-} p_System_IO_hGetChar h = trace "i am here" $ unsafePerformIO (getchar >>= \c -> print c >> return (if c == (-1) then 0 else chr_ c)) chr_ = fromEnum