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 0where f m c | isDigit c = fromIntegral (ord c - ord '0') + (m * 10)| otherwise = error ("Non-digit "++[c]++" in readI")
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe