
22 Mar
2009
22 Mar
'09
7:36 p.m.
On Sun, 22 Mar 2009, Achim Schneider wrote:
Anonymous Anonymous
wrote: Hello,
I'm new to haskell, I'm wondering how can you write a function that will do the following:
fromIntToString :: Int -> String
this is a cast function to cast an Int to a String. I know such function exist, however let's assume it didn't exist. How would I write such function?
I have no Idea, but this one works:
intOfChar c | c >= '0' && c <= '9' = fromEnum c - fromEnum '0' intOfChar _ = undefined
this is 'digitToInt' from Char module