From: Ian Lynagh Date: Sat, 18 Jul 2009 15:10:49 +0000 (+0000) Subject: Make chr say what its argument was, if it's a bad argument X-Git-Tag: ghc-darcs-git-switchover~346 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=811bf3ff4977e169901d81695f1f2340ce3dcb80;p=ghc-base.git Make chr say what its argument was, if it's a bad argument --- diff --git a/GHC/Base.lhs b/GHC/Base.lhs index 3806d78..449a861 100644 --- a/GHC/Base.lhs +++ b/GHC/Base.lhs @@ -101,6 +101,7 @@ import GHC.Classes import GHC.Generics import GHC.Ordering import GHC.Prim +import {-# SOURCE #-} GHC.Show import {-# SOURCE #-} GHC.Err -- These two are not strictly speaking required by this module, but they are @@ -535,8 +536,10 @@ instance Ord Char where -- | The 'Prelude.toEnum' method restricted to the type 'Data.Char.Char'. chr :: Int -> Char -chr (I# i#) | int2Word# i# `leWord#` int2Word# 0x10FFFF# = C# (chr# i#) - | otherwise = error "Prelude.chr: bad argument" +chr i@(I# i#) + | int2Word# i# `leWord#` int2Word# 0x10FFFF# = C# (chr# i#) + | otherwise + = error ("Prelude.chr: bad argument: " ++ showSignedInt (I# 9#) i "") unsafeChr :: Int -> Char unsafeChr (I# i#) = C# (chr# i#) diff --git a/GHC/Show.lhs-boot b/GHC/Show.lhs-boot new file mode 100644 index 0000000..b01d165 --- /dev/null +++ b/GHC/Show.lhs-boot @@ -0,0 +1,10 @@ +\begin{code} +{-# OPTIONS_GHC -XNoImplicitPrelude #-} + +module GHC.Show (showSignedInt) where + +import GHC.Types + +showSignedInt :: Int -> Int -> [Char] -> [Char] +\end{code} +