X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=Unsafe%2FCoerce.hs;h=516d7e06b67d231fb8abac514b7032eef2507cfc;hb=7c6f9cd2077e6092d1f4a5603ae871c3eb2b1315;hp=b1cb11b9a1e5797b8751f1e0fbebc0c808caf082;hpb=35da716a84d9b1fa0cdbebf1b6123fe8593f9b87;p=ghc-base.git diff --git a/Unsafe/Coerce.hs b/Unsafe/Coerce.hs index b1cb11b..516d7e0 100644 --- a/Unsafe/Coerce.hs +++ b/Unsafe/Coerce.hs @@ -1,4 +1,4 @@ -{-# OPTIONS_GHC -fno-implicit-prelude #-} +{-# OPTIONS_GHC -XNoImplicitPrelude #-} ----------------------------------------------------------------------------- -- | -- Module : Unsafe.Coerce @@ -14,13 +14,21 @@ -- it is your responsibility to ensure that the old and new types have -- identical internal representations, in order to prevent runtime corruption. -- --- 'unsafeCoerce' is just a trivial wrapper for 'unsafeCoerce#'; --- see the latter for important documetation about correct usage. +-- The types for which 'unsafeCoerce' is representation-safe may differ +-- from compiler to compiler (and version to version). +-- +-- * Documentation for correct usage in GHC will be found under +-- 'unsafeCoerce#' in GHC.Base (around which 'unsafeCoerce' is just a +-- trivial wrapper). +-- +-- * In nhc98, the only representation-safe coercions are between Enum +-- types with the same range (e.g. Int, Int32, Char, Word32), +-- or between a newtype and the type that it wraps. module Unsafe.Coerce (unsafeCoerce) where #if defined(__GLASGOW_HASKELL__) -import GHC.Base (unsafeCoerce#) +import GHC.Prim (unsafeCoerce#) unsafeCoerce :: a -> b unsafeCoerce = unsafeCoerce# #endif