import GHC.Base
import Data.Maybe
-import GHC.List ( (!!), foldr1
-#ifdef USE_REPORT_PRELUDE
- , concatMap
-#endif
- )
+import GHC.List ((!!), foldr1)
\end{code}
-- I've done manual eta-expansion here, becuase otherwise it's
-- impossible to stop (asciiTab!!ord) getting floated out as an MFE
+isDec :: Char -> Bool
isDec c = c >= '0' && c <= '9'
protectEsc :: (Char -> Bool) -> ShowS -> ShowS
| i >=# 10# && i <=# 15# = unsafeChr (ord 'a' `minusInt` ten `plusInt` I# i)
| otherwise = error ("Char.intToDigit: not a digit " ++ show (I# i))
+ten :: Int
ten = I# 10#
showSignedInt :: Int -> Int -> ShowS
itos :: Int# -> String -> String
itos n# cs
| n# <# 0# =
- let I# minInt# = minInt in
+ let !(I# minInt#) = minInt in
if n# ==# minInt#
-- negateInt# minInt overflows, so we can't do that:
then '-' : itos' (negateInt# (n# `quotInt#` 10#))
| otherwise = itos' n# cs
where
itos' :: Int# -> String -> String
- itos' n# cs
- | n# <# 10# = C# (chr# (ord# '0'# +# n#)) : cs
- | otherwise = case chr# (ord# '0'# +# (n# `remInt#` 10#)) of { c# ->
- itos' (n# `quotInt#` 10#) (C# c# : cs) }
+ itos' x# cs'
+ | x# <# 10# = C# (chr# (ord# '0'# +# x#)) : cs'
+ | otherwise = case chr# (ord# '0'# +# (x# `remInt#` 10#)) of { c# ->
+ itos' (x# `quotInt#` 10#) (C# c# : cs') }
\end{code}