
7 Sep
2006
7 Sep
'06
8:56 a.m.
What about negative numbers? Also, don't use (ord c - ord '0'), it doesn't work with Unicode digits. That's why there is a digitToInt function. -- Lennart On Sep 7, 2006, at 02:12 , Bulat Ziganshin wrote:
readI = foldl f 0 where f m c | isDigit c = fromIntegral (ord c - ord '0') + (m * 10) | otherwise = error ("Non-digit "++[c]++" in readI")