summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Terei <code@davidterei.com>2014-11-19 18:00:11 -0800
committerDavid Terei <code@davidterei.com>2014-11-21 13:03:38 -0800
commit453ce626a32cab3728a640b2299eaeeb30da8862 (patch)
tree68cd150c04c1ae3b94fd741a97a777c6fe0fc502
parent065d43335c03a47f74b702ea1f64a41ddefeb8d3 (diff)
downloadhaskell-453ce626a32cab3728a640b2299eaeeb30da8862.tar.gz
Update Foreign.* for Safe Haskell now that they're safe by default
-rw-r--r--compiler/ghci/RtClosureInspect.hs4
-rw-r--r--compiler/main/InteractiveEval.hs4
-rw-r--r--compiler/utils/FastString.lhs4
-rw-r--r--compiler/utils/StringBuffer.lhs4
-rw-r--r--ghc/InteractiveUI.hs4
-rw-r--r--libraries/base/Foreign.hs2
-rw-r--r--libraries/base/Foreign/ForeignPtr.hs4
-rw-r--r--libraries/base/Foreign/ForeignPtr/Safe.hs2
-rw-r--r--libraries/base/Foreign/Marshal.hs18
-rw-r--r--libraries/base/Foreign/Marshal/Safe.hs2
-rw-r--r--libraries/base/Foreign/Safe.hs10
-rw-r--r--libraries/base/GHC/IO/Encoding/Iconv.hs2
-rw-r--r--libraries/base/GHC/IO/Handle/Internals.hs2
-rw-r--r--libraries/base/System/CPUTime.hsc2
-rw-r--r--libraries/base/System/Environment.hs2
15 files changed, 47 insertions, 19 deletions
diff --git a/compiler/ghci/RtClosureInspect.hs b/compiler/ghci/RtClosureInspect.hs
index 953f9b5cb6..fa9774311f 100644
--- a/compiler/ghci/RtClosureInspect.hs
+++ b/compiler/ghci/RtClosureInspect.hs
@@ -69,7 +69,11 @@ import qualified Data.Sequence as Seq
import Data.Monoid (mappend)
#endif
import Data.Sequence (viewl, ViewL(..))
+#if __GLASGOW_HASKELL__ >= 709
+import Foreign
+#else
import Foreign.Safe
+#endif
import System.IO.Unsafe
---------------------------------------------
diff --git a/compiler/main/InteractiveEval.hs b/compiler/main/InteractiveEval.hs
index f25ed75b48..b22e10e108 100644
--- a/compiler/main/InteractiveEval.hs
+++ b/compiler/main/InteractiveEval.hs
@@ -83,7 +83,11 @@ import Data.Dynamic
import Data.Either
import Data.List (find)
import Control.Monad
+#if __GLASGOW_HASKELL__ >= 709
+import Foreign
+#else
import Foreign.Safe
+#endif
import Foreign.C
import GHC.Exts
import Data.Array
diff --git a/compiler/utils/FastString.lhs b/compiler/utils/FastString.lhs
index 4d98b2bdae..c1f7973e76 100644
--- a/compiler/utils/FastString.lhs
+++ b/compiler/utils/FastString.lhs
@@ -118,7 +118,11 @@ import Data.List ( elemIndex )
import GHC.IO ( IO(..), unsafeDupablePerformIO )
+#if __GLASGOW_HASKELL__ >= 709
+import Foreign
+#else
import Foreign.Safe
+#endif
#if STAGE >= 2
import GHC.Conc.Sync (sharedCAF)
diff --git a/compiler/utils/StringBuffer.lhs b/compiler/utils/StringBuffer.lhs
index d298457bdd..9e6e6c1824 100644
--- a/compiler/utils/StringBuffer.lhs
+++ b/compiler/utils/StringBuffer.lhs
@@ -57,7 +57,11 @@ import System.IO.Unsafe ( unsafePerformIO )
import GHC.Exts
+#if __GLASGOW_HASKELL__ >= 709
+import Foreign
+#else
import Foreign.Safe
+#endif
-- -----------------------------------------------------------------------------
-- The StringBuffer type
diff --git a/ghc/InteractiveUI.hs b/ghc/InteractiveUI.hs
index 7fdda0b0fd..503811731d 100644
--- a/ghc/InteractiveUI.hs
+++ b/ghc/InteractiveUI.hs
@@ -81,7 +81,11 @@ import Data.Maybe
import Exception hiding (catch)
import Foreign.C
+#if __GLASGOW_HASKELL__ >= 709
+import Foreign
+#else
import Foreign.Safe
+#endif
import System.Directory
import System.Environment
diff --git a/libraries/base/Foreign.hs b/libraries/base/Foreign.hs
index 43ee102830..b25e456c60 100644
--- a/libraries/base/Foreign.hs
+++ b/libraries/base/Foreign.hs
@@ -1,4 +1,4 @@
-{-# LANGUAGE Unsafe #-}
+{-# LANGUAGE Safe #-}
{-# LANGUAGE NoImplicitPrelude #-}
-----------------------------------------------------------------------------
diff --git a/libraries/base/Foreign/ForeignPtr.hs b/libraries/base/Foreign/ForeignPtr.hs
index 2e9b9ec08a..cedfba7138 100644
--- a/libraries/base/Foreign/ForeignPtr.hs
+++ b/libraries/base/Foreign/ForeignPtr.hs
@@ -1,4 +1,4 @@
-{-# LANGUAGE Unsafe #-}
+{-# LANGUAGE Trustworthy #-}
{-# LANGUAGE NoImplicitPrelude #-}
-----------------------------------------------------------------------------
@@ -43,5 +43,5 @@ module Foreign.ForeignPtr (
, mallocForeignPtrArray0
) where
-import Foreign.ForeignPtr.Safe
+import Foreign.ForeignPtr.Imp
diff --git a/libraries/base/Foreign/ForeignPtr/Safe.hs b/libraries/base/Foreign/ForeignPtr/Safe.hs
index 190e8b680a..d8a7c538f3 100644
--- a/libraries/base/Foreign/ForeignPtr/Safe.hs
+++ b/libraries/base/Foreign/ForeignPtr/Safe.hs
@@ -19,7 +19,7 @@
--
-----------------------------------------------------------------------------
-module Foreign.ForeignPtr.Safe (
+module Foreign.ForeignPtr.Safe {-# DEPRECATED "Safe is now the default, please use Foreign.ForeignPtr instead" #-} (
-- * Finalised data pointers
ForeignPtr
, FinalizerPtr
diff --git a/libraries/base/Foreign/Marshal.hs b/libraries/base/Foreign/Marshal.hs
index 9336549c6f..15bed179cb 100644
--- a/libraries/base/Foreign/Marshal.hs
+++ b/libraries/base/Foreign/Marshal.hs
@@ -1,4 +1,4 @@
-{-# LANGUAGE Unsafe #-}
+{-# LANGUAGE Safe #-}
{-# LANGUAGE NoImplicitPrelude #-}
-----------------------------------------------------------------------------
@@ -17,10 +17,18 @@
module Foreign.Marshal
(
- -- | The module "Foreign.Marshal" re-exports the safe content in the
- -- @Foreign.Marshal@ hierarchy:
- module Foreign.Marshal.Safe
+ -- | The module "Foreign.Marshal.Safe" re-exports the other modules in the
+ -- @Foreign.Marshal@ hierarchy (except for @Foreign.Marshal.Unsafe@):
+ module Foreign.Marshal.Alloc
+ , module Foreign.Marshal.Array
+ , module Foreign.Marshal.Error
+ , module Foreign.Marshal.Pool
+ , module Foreign.Marshal.Utils
) where
-import Foreign.Marshal.Safe
+import Foreign.Marshal.Alloc
+import Foreign.Marshal.Array
+import Foreign.Marshal.Error
+import Foreign.Marshal.Pool
+import Foreign.Marshal.Utils
diff --git a/libraries/base/Foreign/Marshal/Safe.hs b/libraries/base/Foreign/Marshal/Safe.hs
index 85bad2bdd7..5cc2982820 100644
--- a/libraries/base/Foreign/Marshal/Safe.hs
+++ b/libraries/base/Foreign/Marshal/Safe.hs
@@ -17,7 +17,7 @@
--
-----------------------------------------------------------------------------
-module Foreign.Marshal.Safe
+module Foreign.Marshal.Safe {-# DEPRECATED "Safe is now the default, please use Foreign.Marshal instead" #-}
(
-- | The module "Foreign.Marshal.Safe" re-exports the other modules in the
-- @Foreign.Marshal@ hierarchy:
diff --git a/libraries/base/Foreign/Safe.hs b/libraries/base/Foreign/Safe.hs
index 9809aff1cb..6b84d1733e 100644
--- a/libraries/base/Foreign/Safe.hs
+++ b/libraries/base/Foreign/Safe.hs
@@ -18,23 +18,23 @@
--
-----------------------------------------------------------------------------
-module Foreign.Safe
+module Foreign.Safe {-# DEPRECATED "Safe is now the default, please use Foreign instead" #-}
( module Data.Bits
, module Data.Int
, module Data.Word
, module Foreign.Ptr
- , module Foreign.ForeignPtr.Safe
+ , module Foreign.ForeignPtr
, module Foreign.StablePtr
, module Foreign.Storable
- , module Foreign.Marshal.Safe
+ , module Foreign.Marshal
) where
import Data.Bits
import Data.Int
import Data.Word
import Foreign.Ptr
-import Foreign.ForeignPtr.Safe
+import Foreign.ForeignPtr
import Foreign.StablePtr
import Foreign.Storable
-import Foreign.Marshal.Safe
+import Foreign.Marshal
diff --git a/libraries/base/GHC/IO/Encoding/Iconv.hs b/libraries/base/GHC/IO/Encoding/Iconv.hs
index 892f84498e..89ca71e084 100644
--- a/libraries/base/GHC/IO/Encoding/Iconv.hs
+++ b/libraries/base/GHC/IO/Encoding/Iconv.hs
@@ -33,7 +33,7 @@ module GHC.IO.Encoding.Iconv (
import GHC.Base () -- For build ordering
#else
-import Foreign.Safe
+import Foreign
import Foreign.C
import Data.Maybe
import GHC.Base
diff --git a/libraries/base/GHC/IO/Handle/Internals.hs b/libraries/base/GHC/IO/Handle/Internals.hs
index 2865136a66..99cfb312a8 100644
--- a/libraries/base/GHC/IO/Handle/Internals.hs
+++ b/libraries/base/GHC/IO/Handle/Internals.hs
@@ -74,7 +74,7 @@ import GHC.IORef
import GHC.MVar
import Data.Typeable
import Data.Maybe
-import Foreign.Safe
+import Foreign
import System.Posix.Internals hiding (FD)
import Foreign.C
diff --git a/libraries/base/System/CPUTime.hsc b/libraries/base/System/CPUTime.hsc
index 1d2f341d18..e09439c0e8 100644
--- a/libraries/base/System/CPUTime.hsc
+++ b/libraries/base/System/CPUTime.hsc
@@ -26,7 +26,7 @@ module System.CPUTime
import Data.Ratio
-import Foreign.Safe
+import Foreign
import Foreign.C
-- For struct rusage
diff --git a/libraries/base/System/Environment.hs b/libraries/base/System/Environment.hs
index ee91b78d79..9beefc4be3 100644
--- a/libraries/base/System/Environment.hs
+++ b/libraries/base/System/Environment.hs
@@ -29,7 +29,7 @@ module System.Environment
getEnvironment,
) where
-import Foreign.Safe
+import Foreign
import Foreign.C
import System.IO.Error (mkIOError)
import Control.Exception.Base (bracket, throwIO)