Allow -X flags to be deprecated, and deprecate RecordPuns; fixes #2320
[ghc-hetmet.git] / compiler / prelude / primops.txt.pp
index 61a6964..d4fd608 100644 (file)
@@ -619,10 +619,11 @@ primop   DoubleDecodeOp   "decodeDouble#" GenPrimOp
    with out_of_line = True
 
 primop   DoubleDecode_2IntOp   "decodeDouble_2Int#" GenPrimOp    
-   Double# -> (# Int#, Int#, Int# #)
+   Double# -> (# Int#, Word#, Word#, Int# #)
    {Convert to arbitrary-precision integer.
-    First {\tt Int\#} in result is the high 32 bits of the mantissa, and the
-    second is the low 32. The third is the exponent.}
+    First component of the result is -1 or 1, indicating the sign of the
+    mantissa. The next two are the high and low 32 bits of the mantissa
+    respectively, and the last is the exponent.}
    with out_of_line = True
 
 ------------------------------------------------------------------------
@@ -1801,6 +1802,7 @@ pseudoop   "unsafeCoerce#"
          * Casting {\tt Any} back to the real type
 
          * Casting an unboxed type to another unboxed type of the same size
+           (but not coercions between floating-point and integral types)
 
          * Casting between two types that have the same runtime representation.  One case is when
            the two types differ only in "phantom" type parameters, for example
@@ -1808,7 +1810,14 @@ pseudoop   "unsafeCoerce#"
            known to be empty.  Also, a {\tt newtype} of a type {\tt T} has the same representation
            at runtime as {\tt T}.
 
-        Other uses of {\tt unsafeCoerce\#} are undefined.
+        Other uses of {\tt unsafeCoerce\#} are undefined.  In particular, you should not use
+       {\tt unsafeCoerce\#} to cast a T to an algebraic data type D, unless T is also
+       an algebraic data type.  For example, do not cast {\tt Int->Int} to {\tt Bool}, even if
+        you later cast that {\tt Bool} back to {\tt Int->Int} before applying it.  The reasons
+        have to do with GHC's internal representation details (for the congnoscenti, data values
+       can be entered but function closures cannot).  If you want a safe type to cast things
+       to, use {\tt Any}, which is not an algebraic data type.
+       
         }
 
 -- NB. It is tempting to think that casting a value to a type that it doesn't have is safe