summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libraries/base/GHC/Conc/POSIX.hs5
-rw-r--r--libraries/base/GHC/Conc/Windows.hs5
-rw-r--r--libraries/base/GHC/ForeignPtr.hs14
3 files changed, 11 insertions, 13 deletions
diff --git a/libraries/base/GHC/Conc/POSIX.hs b/libraries/base/GHC/Conc/POSIX.hs
index 3a6ddf2287..44d142c981 100644
--- a/libraries/base/GHC/Conc/POSIX.hs
+++ b/libraries/base/GHC/Conc/POSIX.hs
@@ -60,7 +60,6 @@ import GHC.Ptr
import GHC.Real (div, fromIntegral)
import GHC.Word (Word32, Word64)
import GHC.Windows
-import Unsafe.Coerce ( unsafeCoerceUnlifted )
-- ----------------------------------------------------------------------------
-- Thread waiting
@@ -92,11 +91,11 @@ asyncDoProc (FunPtr proc) (Ptr param) =
-- this better be a pinned byte array!
asyncReadBA :: Int -> Int -> Int -> Int -> MutableByteArray# RealWorld -> IO (Int,Int)
asyncReadBA fd isSock len off bufB =
- asyncRead fd isSock len ((Ptr (byteArrayContents# (unsafeCoerceUnlifted bufB))) `plusPtr` off)
+ asyncRead fd isSock len ((Ptr (mutableByteArrayContents# bufB)) `plusPtr` off)
asyncWriteBA :: Int -> Int -> Int -> Int -> MutableByteArray# RealWorld -> IO (Int,Int)
asyncWriteBA fd isSock len off bufB =
- asyncWrite fd isSock len ((Ptr (byteArrayContents# (unsafeCoerceUnlifted bufB))) `plusPtr` off)
+ asyncWrite fd isSock len ((Ptr (mutableByteArrayContents# bufB)) `plusPtr` off)
-- ----------------------------------------------------------------------------
-- Threaded RTS implementation of threadDelay
diff --git a/libraries/base/GHC/Conc/Windows.hs b/libraries/base/GHC/Conc/Windows.hs
index 34131cc416..fe452cbe32 100644
--- a/libraries/base/GHC/Conc/Windows.hs
+++ b/libraries/base/GHC/Conc/Windows.hs
@@ -48,7 +48,6 @@ import qualified GHC.Conc.WinIO as WINIO
import GHC.Event.Windows.ConsoleEvent
import GHC.IO.SubSystem ((<!>))
import GHC.Ptr
-import Unsafe.Coerce ( unsafeCoerceUnlifted )
-- ----------------------------------------------------------------------------
-- Thread waiting
@@ -80,11 +79,11 @@ asyncDoProc (FunPtr proc) (Ptr param) =
-- this better be a pinned byte array!
asyncReadBA :: Int -> Int -> Int -> Int -> MutableByteArray# RealWorld -> IO (Int,Int)
asyncReadBA fd isSock len off bufB =
- asyncRead fd isSock len ((Ptr (byteArrayContents# (unsafeCoerceUnlifted bufB))) `plusPtr` off)
+ asyncRead fd isSock len ((Ptr (mutableByteArrayContents# bufB)) `plusPtr` off)
asyncWriteBA :: Int -> Int -> Int -> Int -> MutableByteArray# RealWorld -> IO (Int,Int)
asyncWriteBA fd isSock len off bufB =
- asyncWrite fd isSock len ((Ptr (byteArrayContents# (unsafeCoerceUnlifted bufB))) `plusPtr` off)
+ asyncWrite fd isSock len ((Ptr (mutableByteArrayContents# bufB)) `plusPtr` off)
-- ----------------------------------------------------------------------------
-- Threaded RTS implementation of threadDelay
diff --git a/libraries/base/GHC/ForeignPtr.hs b/libraries/base/GHC/ForeignPtr.hs
index 774dafdf70..a7061152dc 100644
--- a/libraries/base/GHC/ForeignPtr.hs
+++ b/libraries/base/GHC/ForeignPtr.hs
@@ -64,7 +64,7 @@ import GHC.IORef
import GHC.STRef ( STRef(..) )
import GHC.Ptr ( Ptr(..), FunPtr(..) )
-import Unsafe.Coerce ( unsafeCoerce, unsafeCoerceUnlifted )
+import Unsafe.Coerce ( unsafeCoerce )
-- |The type 'ForeignPtr' represents references to objects that are
-- maintained in a foreign language, i.e., that are not part of the
@@ -282,7 +282,7 @@ mallocForeignPtr = doMalloc undefined
r <- newIORef NoFinalizers
IO $ \s ->
case newAlignedPinnedByteArray# size align s of { (# s', mbarr# #) ->
- (# s', ForeignPtr (byteArrayContents# (unsafeCoerceUnlifted mbarr#))
+ (# s', ForeignPtr (mutableByteArrayContents# mbarr#)
(MallocPtr mbarr# r) #)
}
where !(I# size) = sizeOf a
@@ -297,7 +297,7 @@ mallocForeignPtrBytes (I# size) = do
r <- newIORef NoFinalizers
IO $ \s ->
case newPinnedByteArray# size s of { (# s', mbarr# #) ->
- (# s', ForeignPtr (byteArrayContents# (unsafeCoerceUnlifted mbarr#))
+ (# s', ForeignPtr (mutableByteArrayContents# mbarr#)
(MallocPtr mbarr# r) #)
}
@@ -311,7 +311,7 @@ mallocForeignPtrAlignedBytes (I# size) (I# align) = do
r <- newIORef NoFinalizers
IO $ \s ->
case newAlignedPinnedByteArray# size align s of { (# s', mbarr# #) ->
- (# s', ForeignPtr (byteArrayContents# (unsafeCoerceUnlifted mbarr#))
+ (# s', ForeignPtr (mutableByteArrayContents# mbarr#)
(MallocPtr mbarr# r) #)
}
@@ -335,7 +335,7 @@ mallocPlainForeignPtr = doMalloc undefined
| I# size < 0 = errorWithoutStackTrace "mallocForeignPtr: size must be >= 0"
| otherwise = IO $ \s ->
case newAlignedPinnedByteArray# size align s of { (# s', mbarr# #) ->
- (# s', ForeignPtr (byteArrayContents# (unsafeCoerceUnlifted mbarr#))
+ (# s', ForeignPtr (mutableByteArrayContents# mbarr#)
(PlainPtr mbarr#) #)
}
where !(I# size) = sizeOf a
@@ -350,7 +350,7 @@ mallocPlainForeignPtrBytes size | size < 0 =
errorWithoutStackTrace "mallocPlainForeignPtrBytes: size must be >= 0"
mallocPlainForeignPtrBytes (I# size) = IO $ \s ->
case newPinnedByteArray# size s of { (# s', mbarr# #) ->
- (# s', ForeignPtr (byteArrayContents# (unsafeCoerceUnlifted mbarr#))
+ (# s', ForeignPtr (mutableByteArrayContents# mbarr#)
(PlainPtr mbarr#) #)
}
@@ -363,7 +363,7 @@ mallocPlainForeignPtrAlignedBytes size _align | size < 0 =
errorWithoutStackTrace "mallocPlainForeignPtrAlignedBytes: size must be >= 0"
mallocPlainForeignPtrAlignedBytes (I# size) (I# align) = IO $ \s ->
case newAlignedPinnedByteArray# size align s of { (# s', mbarr# #) ->
- (# s', ForeignPtr (byteArrayContents# (unsafeCoerceUnlifted mbarr#))
+ (# s', ForeignPtr (mutableByteArrayContents# mbarr#)
(PlainPtr mbarr#) #)
}