summaryrefslogtreecommitdiff
path: root/compiler/GHC/Utils/IO/Unsafe.hs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/GHC/Utils/IO/Unsafe.hs')
-rw-r--r--compiler/GHC/Utils/IO/Unsafe.hs22
1 files changed, 22 insertions, 0 deletions
diff --git a/compiler/GHC/Utils/IO/Unsafe.hs b/compiler/GHC/Utils/IO/Unsafe.hs
new file mode 100644
index 0000000000..27efe373f7
--- /dev/null
+++ b/compiler/GHC/Utils/IO/Unsafe.hs
@@ -0,0 +1,22 @@
+{-
+(c) The University of Glasgow, 2000-2006
+-}
+
+{-# LANGUAGE CPP, MagicHash, UnboxedTuples #-}
+
+module GHC.Utils.IO.Unsafe
+ ( inlinePerformIO,
+ )
+where
+
+#include "HsVersions.h"
+
+import GHC.Prelude ()
+
+import GHC.Exts
+import GHC.IO (IO(..))
+
+-- Just like unsafeDupablePerformIO, but we inline it.
+{-# INLINE inlinePerformIO #-}
+inlinePerformIO :: IO a -> a
+inlinePerformIO (IO m) = case m realWorld# of (# _, r #) -> r