2 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1996
4 \section[UnsafeST]{Unsafe ST operations}
6 VERY IMPORTANT! This module must be compiled without "-O". If you
7 compile it with "-O" then the inlinings of the unsafe ST operators are exposed.
8 It turns out that exposing these inlininings can lead to unsound transformations,
9 such as generating a MutVar only once rather than once each call to unsafePerformIO.
12 {-# OPTIONS -fno-implicit-prelude -Onot #-}
20 unsafeInterleavePrimIO
28 unsafeInterleaveST :: ST s a -> ST s a
29 unsafeInterleaveST (ST m) = ST $ \ s ->
35 unsafePerformPrimIO :: PrimIO a -> a
36 -- We give a fresh definition here. There are no
37 -- magical universal types kicking around.
38 unsafePerformPrimIO (ST m)
39 = case m (S# realWorld#) of
42 unsafeInterleavePrimIO :: PrimIO a -> PrimIO a
43 unsafeInterleavePrimIO = unsafeInterleaveST