[Haskell-cafe] Reading integers
lennart at augustsson.net
Thu Sep 7 08:56:03 EDT 2006
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.
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 *
> | otherwise = error ("Non-digit "++[c]++" in readI")
More information about the Haskell-Cafe