
2 Sep
2003
2 Sep
'03
9:46 a.m.
The definition of fixIO used by Nhc (in System.IO), namely fixIO f = let x = unsafePerformIO (f x) in return x produces the wrong results for programs like main = do putStrLn "aaa" ds <- fixIO $ \ds -> do putStrLn "bbb" return ('d':ds) putStrLn "ccc" putStrLn (take 3 ds) (The "left tightening" law says that moving putStrLn "bbb" up a line should not change the meaning.) I suggest: fixIO f = IO (\w -> let { IO f' = f a; r = f' w; Right a = r } in r)