summaryrefslogtreecommitdiff
path: root/libraries/base/Unsafe
diff options
context:
space:
mode:
authorMalcolm.Wallace@cs.york.ac.uk <unknown>2008-04-22 13:05:47 +0000
committerMalcolm.Wallace@cs.york.ac.uk <unknown>2008-04-22 13:05:47 +0000
commita83c99633384191fb5c3e7514426aa2d5b12ed0f (patch)
treeec147aa2749fc6c88cfd6a3555c28e74ebe8b235 /libraries/base/Unsafe
parent2d817e6327b9525b328162176dd71d79c91b13a0 (diff)
downloadhaskell-a83c99633384191fb5c3e7514426aa2d5b12ed0f.tar.gz
Improve docs for unsafeCoerce
Make it clear that compilers differ. Point to GHC docs in GHC.Base, and add a short description of nhc98's representation-safe conversions.
Diffstat (limited to 'libraries/base/Unsafe')
-rw-r--r--libraries/base/Unsafe/Coerce.hs12
1 files changed, 10 insertions, 2 deletions
diff --git a/libraries/base/Unsafe/Coerce.hs b/libraries/base/Unsafe/Coerce.hs
index 00444bd107..e911c6fc57 100644
--- a/libraries/base/Unsafe/Coerce.hs
+++ b/libraries/base/Unsafe/Coerce.hs
@@ -14,8 +14,16 @@
-- 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 documentation 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