On Sun, 22 Mar 2009, Achim Schneider wrote:

Anonymous Anonymous <[email protected]> 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
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to