summaryrefslogtreecommitdiff
path: root/compiler/utils/Encoding.hs
diff options
context:
space:
mode:
authorSimon Marlow <simonmar@microsoft.com>2006-04-11 08:50:09 +0000
committerSimon Marlow <simonmar@microsoft.com>2006-04-11 08:50:09 +0000
commit13de816da2c8cb8509e05198c0da47560fd3e0de (patch)
treef4d4fb045325f9c4556d026bd8ffae97504cbfc7 /compiler/utils/Encoding.hs
parent57aa4c8a73431b78a37428eb32af5978bfdc5f2b (diff)
downloadhaskell-13de816da2c8cb8509e05198c0da47560fd3e0de.tar.gz
avoid versionitis in Numeric.showHex (should fix tcrun007)
Diffstat (limited to 'compiler/utils/Encoding.hs')
-rw-r--r--compiler/utils/Encoding.hs9
1 files changed, 6 insertions, 3 deletions
diff --git a/compiler/utils/Encoding.hs b/compiler/utils/Encoding.hs
index 152bf3c60e..c7f90706f9 100644
--- a/compiler/utils/Encoding.hs
+++ b/compiler/utils/Encoding.hs
@@ -26,9 +26,9 @@ module Encoding (
#define COMPILING_FAST_STRING
#include "HsVersions.h"
import Foreign
-import Data.Char ( ord, chr, isDigit, digitToInt, isHexDigit )
-import Numeric ( showHex )
-
+import Data.Char ( ord, chr, isDigit, digitToInt, intToDigit,
+ isHexDigit )
+import Numeric ( showIntAtBase )
import Data.Bits
import GHC.Ptr ( Ptr(..) )
import GHC.Base
@@ -281,6 +281,9 @@ encode_ch c = 'z' : if isDigit (head hex_str) then hex_str
-- eg. strings of unicode characters come out as 'z1234Uz5678U', we
-- could remove the 'U' in the middle (the 'z' works as a separator).
+ showHex = showIntAtBase 16 intToDigit
+ -- needed because prior to GHC 6.2, Numeric.showHex added a "0x" prefix
+
zDecodeString :: EncodedString -> UserString
zDecodeString [] = []
zDecodeString ('Z' : d : rest)