Moved Show instance for Addr from PrelAddr to Addr & made it display
the Addr in hex (+ have it cope with ptrs with MSB set.)
import PrelForeign
import PrelStable
import PrelBase
+import NumExts
import PrelIOBase ( IO(..) )
import Word ( indexWord8OffAddr, indexWord16OffAddr
, indexWord32OffAddr, indexWord64OffAddr
\end{code}
+\begin{code}
+instance Show Addr where
+ showsPrec p (A# a) = showHex int
+ where
+ int =
+ case word2Integer# (int2Word# (addr2Int# a)) of
+ (# s, d #) -> J# s d
+
+\end{code}
+
+
Coercing between machine ints and words
\begin{code}
import PrelGHC
import PrelBase
-import PrelShow
import PrelCCall
\end{code}
data Addr = A# Addr# deriving (Eq, Ord)
data Word = W# Word# deriving (Eq, Ord)
-instance Show Addr where
- showsPrec p (A# a) = showsPrec p (I# (addr2Int# a))
-
nullAddr :: Addr
nullAddr = A# (int2Addr# 0#)