[project @ 2001-08-04 06:11:24 by ken]
[ghc-hetmet.git] / ghc / lib / std / Char.lhs
index f5c4899..1fbc390 100644 (file)
@@ -1,7 +1,8 @@
+% -----------------------------------------------------------------------------
+% $Id: Char.lhs,v 1.8 2000/12/11 17:51:34 simonmar Exp $
 %
-% (c) The AQUA Project, Glasgow University, 1994-1996
+% (c) The University of Glasgow, 1994-2000
 %
-
 \section[Char]{Module @Char@}
 
 \begin{code}
 
 module Char 
     ( 
-     isAscii, isLatin1, isControl, 
-     isPrint, isSpace,  isUpper, 
-     isLower, isAlpha,  isDigit,  
-     isOctDigit, isHexDigit, isAlphanum,  -- :: Char -> Bool
+      Char
 
-     toUpper, toLower,  -- :: Char -> Char
+    , isAscii, isLatin1, isControl
+    , isPrint, isSpace,  isUpper
+    , isLower, isAlpha,  isDigit
+    , isOctDigit, isHexDigit, isAlphaNum  -- :: Char -> Bool
 
-     digitToInt,        -- :: Char -> Int
-     intToDigit,        -- :: Int  -> Char
+    , toUpper, toLower  -- :: Char -> Char
 
-     ord,               -- :: Char -> Int
-     chr,               -- :: Int  -> Char
-     readLitChar,       -- :: ReadS Char 
-     showLitChar        -- :: Char -> ShowS
-    ) where
+    , digitToInt        -- :: Char -> Int
+    , intToDigit        -- :: Int  -> Char
 
-import PrelBase
-import PrelRead (readLitChar)
-import {-# SOURCE #-} PrelErr   ( error )
+    , ord               -- :: Char -> Int
+    , chr               -- :: Int  -> Char
+    , readLitChar       -- :: ReadS Char 
+    , showLitChar       -- :: Char -> ShowS
+    , lexLitChar       -- :: ReadS String
 
-\end{code}
-
-\begin{code}
--- Digit conversion operations
-
-digitToInt :: Char -> Int
-digitToInt c
- | isDigit c           =  fromEnum c - fromEnum '0'
- | c >= 'a' && c <= 'f' =  fromEnum c - fromEnum 'a' + 10
- | c >= 'A' && c <= 'F' =  fromEnum c - fromEnum 'A' + 10
- | otherwise           =  error "Char.digitToInt: not a digit" -- sigh
+    , String
 
+     -- Implementation checked wrt. Haskell 98 lib report, 1/99.
+    ) where
 
+#ifndef __HUGS__
+import PrelBase
+import PrelShow
+import PrelRead (readLitChar, lexLitChar, digitToInt)
+#else
+isLatin1 c = True
+#endif
 \end{code}