summaryrefslogtreecommitdiff
path: root/libraries/base/Foreign.hs
diff options
context:
space:
mode:
authorDavid Terei <davidterei@gmail.com>2011-05-16 14:57:46 -0700
committerDavid Terei <davidterei@gmail.com>2011-06-18 01:06:34 -0700
commita61aedc730e68a1b0c166b81a65a8ea575e8094b (patch)
tree85e0237044e1ec4bc29e1bfb80076055035eb6f7 /libraries/base/Foreign.hs
parent191656199189e584e66dda194b7f772694388102 (diff)
downloadhaskell-a61aedc730e68a1b0c166b81a65a8ea575e8094b.tar.gz
SafeHaskell: Added SafeHaskell to base
Diffstat (limited to 'libraries/base/Foreign.hs')
-rw-r--r--libraries/base/Foreign.hs19
1 files changed, 18 insertions, 1 deletions
diff --git a/libraries/base/Foreign.hs b/libraries/base/Foreign.hs
index a26ffaf2bd..e6280b6a84 100644
--- a/libraries/base/Foreign.hs
+++ b/libraries/base/Foreign.hs
@@ -1,3 +1,6 @@
+#if sh_SAFE_DEFAULT
+{-# LANGUAGE Trustworthy #-}
+#endif
{-# LANGUAGE NoImplicitPrelude #-}
-----------------------------------------------------------------------------
@@ -25,11 +28,15 @@ module Foreign
, module Foreign.Storable
, module Foreign.Marshal
+#if !sh_SAFE_DEFAULT
+ -- * Unsafe Functions
+
-- | 'unsafePerformIO' is exported here for backwards
-- compatibility reasons only. For doing local marshalling in
-- the FFI, use 'unsafeLocalState'. For other uses, see
-- 'System.IO.Unsafe.unsafePerformIO'.
, unsafePerformIO
+#endif
) where
import Data.Bits
@@ -41,4 +48,14 @@ import Foreign.StablePtr
import Foreign.Storable
import Foreign.Marshal
-import System.IO.Unsafe (unsafePerformIO)
+#if !sh_SAFE_DEFAULT
+import GHC.IO (IO)
+import qualified System.IO.Unsafe (unsafePerformIO)
+
+{-# DEPRECATED unsafePerformIO "Use System.IO.Unsafe.unsafePerformIO instead; This function will be removed in the next release" #-}
+
+{-# INLINE unsafePerformIO #-}
+unsafePerformIO :: IO a -> a
+unsafePerformIO = System.IO.Unsafe.unsafePerformIO
+#endif
+