[commit: ghc] master: Replace an unsafeCoerce with coerce (fc66415)

git at git.haskell.org git at git.haskell.org
Thu Aug 4 14:28:27 UTC 2016


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/fc66415b11523dcd0bff267225cc901203515060/ghc

>---------------------------------------------------------------

commit fc66415b11523dcd0bff267225cc901203515060
Author: Ryan Scott <ryan.gl.scott at gmail.com>
Date:   Thu Aug 4 10:25:10 2016 -0400

    Replace an unsafeCoerce with coerce
    
    This matches the implementations of `castPtr` and `castFunPtr`.


>---------------------------------------------------------------

fc66415b11523dcd0bff267225cc901203515060
 libraries/base/GHC/ForeignPtr.hs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libraries/base/GHC/ForeignPtr.hs b/libraries/base/GHC/ForeignPtr.hs
index aaad3c6..b9b29ea 100644
--- a/libraries/base/GHC/ForeignPtr.hs
+++ b/libraries/base/GHC/ForeignPtr.hs
@@ -432,7 +432,7 @@ unsafeForeignPtrToPtr (ForeignPtr fo _) = Ptr fo
 castForeignPtr :: ForeignPtr a -> ForeignPtr b
 -- ^This function casts a 'ForeignPtr'
 -- parameterised by one type into another type.
-castForeignPtr f = unsafeCoerce# f
+castForeignPtr = coerce
 
 -- | Causes the finalizers associated with a foreign pointer to be run
 -- immediately.



More information about the ghc-commits mailing list