Repository : ssh://darcs.haskell.org//srv/darcs/packages/base

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/cbfdfd47ed8f709ccb4a010bf30cdcbe66396f55

>---------------------------------------------------------------

commit cbfdfd47ed8f709ccb4a010bf30cdcbe66396f55
Author: Ian Lynagh <[email protected]>
Date:   Fri Sep 16 02:57:44 2011 +0100

    Give Word a proper Show instance
    
    It was going via Integer before

>---------------------------------------------------------------

 GHC/Word.hs |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/GHC/Word.hs b/GHC/Word.hs
index 443f083..6dd308a 100644
--- a/GHC/Word.hs
+++ b/GHC/Word.hs
@@ -50,7 +50,14 @@ import GHC.Float ()     -- for RealFrac methods
 data Word = W# Word# deriving (Eq, Ord)
 
 instance Show Word where
-    showsPrec p x = showsPrec p (toInteger x)
+    showsPrec _ (W# w) = showWord w
+
+showWord :: Word# -> ShowS
+showWord w# cs
+ | w# `ltWord#` 10## = C# (chr# (ord# '0'# +# word2Int# w#)) : cs
+ | otherwise = case chr# (ord# '0'# +# word2Int# (w# `remWord#` 10##)) of
+               c# ->
+                   showWord (w# `quotWord#` 10##) (C# c# : cs)
 
 instance Num Word where
     (W# x#) + (W# y#)      = W# (x# `plusWord#` y#)



_______________________________________________
Cvs-libraries mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-libraries

Reply via email to