[project @ 2004-10-17 00:09:58 by ross]
[ghc-base.git] / GHC / IOBase.lhs
index 6fa596a..07273f9 100644 (file)
@@ -122,6 +122,12 @@ stToIO (ST m) = IO m
 ioToST       :: IO a -> ST RealWorld a
 ioToST (IO m) = (ST m)
 
+-- This relies on IO and ST having the same representation modulo the
+-- constraint on the type of the state
+--
+unsafeIOToST        :: IO a -> ST s a
+unsafeIOToST (IO io) = ST $ \ s -> (unsafeCoerce# io) s
+
 -- ---------------------------------------------------------------------------
 -- Unsafe IO operations