From cdbc0add0b57037795c46ef50f7a22c260a41fdc Mon Sep 17 00:00:00 2001
From: sof <unknown>
Date: Tue, 21 Sep 1999 08:59:47 +0000
Subject: [PATCH] [project @ 1999-09-21 08:59:46 by sof] Moved Show instance
 for Addr from PrelAddr to Addr & made it display the Addr in hex (+ have it
 cope with ptrs with MSB set.)

---
 ghc/lib/exts/Addr.lhs    | 12 ++++++++++++
 ghc/lib/std/PrelAddr.lhs |  4 ----
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/ghc/lib/exts/Addr.lhs b/ghc/lib/exts/Addr.lhs
index 6d9149d60f01..5e02bf2d9fa6 100644
--- a/ghc/lib/exts/Addr.lhs
+++ b/ghc/lib/exts/Addr.lhs
@@ -28,6 +28,7 @@ import PrelAddr
 import PrelForeign
 import PrelStable
 import PrelBase
+import NumExts
 import PrelIOBase ( IO(..) )
 import Word	( indexWord8OffAddr,  indexWord16OffAddr
 		, indexWord32OffAddr, indexWord64OffAddr
@@ -48,6 +49,17 @@ import Int	( indexInt8OffAddr,  indexInt16OffAddr
 
 \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}
diff --git a/ghc/lib/std/PrelAddr.lhs b/ghc/lib/std/PrelAddr.lhs
index b334fd0bc5d3..510feb69dc61 100644
--- a/ghc/lib/std/PrelAddr.lhs
+++ b/ghc/lib/std/PrelAddr.lhs
@@ -22,7 +22,6 @@ module PrelAddr (
 
 import PrelGHC
 import PrelBase
-import PrelShow
 import PrelCCall
 \end{code}
 
@@ -30,9 +29,6 @@ import PrelCCall
 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#)
 
-- 
GitLab