
Andre W B Furtado wrote:
Well, it's also possible to interchange data between these two monads by:
unsafeIOToST :: IO a -> ST s a stToIO :: ST s a -> IO a
Can anyone tell the possible problems related to unsafeIOToST? ^^^^^^
Probably in the same manner as with unsafePerformIO: it can break referential transparency. changeFile fileName = unsafePerformIO (writeFile fileName "Hello, world") fileContents fileName = unsafePerformIO (readFile fileName) Now, if there is a call to changeFile between two calls to fileContents with the same filename (assumed that the file didn't contain the text "Hello, world") the function returns different answers in exactly syntactic identical calls. Thus, referential transparency is broken. Rijk-Jan van Haaften