@@ -160,18 +160,22 @@ hexadecimal :: Integral a => a -> Builder
160{-# SPECIALIZE hexadecimal :: Word16 -> Builder #-}
160{-# SPECIALIZE hexadecimal :: Word16 -> Builder #-}
161{-# SPECIALIZE hexadecimal :: Word32 -> Builder #-}
161{-# SPECIALIZE hexadecimal :: Word32 -> Builder #-}
162{-# SPECIALIZE hexadecimal :: Word64 -> Builder #-}
162{-# SPECIALIZE hexadecimal :: Word64 -> Builder #-}
163−{-# RULES "hexadecimal/Integer" hexadecimal = integer 16 :: Integer -> Builder #-}
163+{-# RULES "hexadecimal/Integer"
164+ hexadecimal = hexInteger :: Integer -> Builder #-}
164hexadecimal i
165hexadecimal i
165− | i < 0 = error msg
166+ | i < 0 = error hexErrMsg
166 | otherwise = go i
167 | otherwise = go i
168 go n | n < 16 = hexDigit n
169 go n | n < 16 = hexDigit n
169 | otherwise = go (n `quot` 16) <> hexDigit (n `rem` 16)
170 | otherwise = go (n `quot` 16) <> hexDigit (n `rem` 16)
170− msg = "Data.Text.Lazy.Builder.Int.hexadecimal: applied to negative number"
172−digit :: Integral a => a -> Builder
172+hexInteger :: Integer -> Builder
173−digit n = singleton $! i2d (fromIntegral n)
173+hexInteger i
174−{-# INLINE digit #-}
174+ | i < 0 = error hexErrMsg
175+ | otherwise = integer 16 i
178+hexErrMsg = "Data.Text.Lazy.Builder.Int.hexadecimal: applied to negative number"
176hexDigit :: Integral a => a -> Builder
180hexDigit :: Integral a => a -> Builder
177hexDigit n
181hexDigit n
@@ -244,7 +248,7 @@ integer base i
244 pblock = loop maxDigits
248 pblock = loop maxDigits
246 loop !d !n
250 loop !d !n
247− | d == 1 = digit n
251+ | d == 1 = hexDigit n
248− | otherwise = loop (d-1) q <> digit r
252+ | otherwise = loop (d-1) q <> hexDigit r
249 where q = n `quotInt` base
253 where q = n `quotInt` base
250 r = n `remInt` base
254 r = n `remInt` base