[Haskell-cafe] Function to cast types
temp.public at gmail.com
Sun Mar 22 09:20:26 EDT 2009
I'm new to haskell, I'm wondering how can you write a function that will do
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? Cause I have no idea, because there are infinity possibilities if
I do it like:
fromIntToString x | x == 1 = "1"
| x == 2 = "2"
-- And so on...
I've also thinked about defining the defining the data types Int and String
(I know you cannot redefine them, at least I think so), however I've no
Thank you in advance for answering my question!
PS: if possible please do not use any casting functions that are predefined.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe