[Haskell-cafe] Function to cast types
haskell at colquitt.org
Sun Mar 22 10:16:23 EDT 2009
> I'm new to haskell, I'm wondering how can you write a function that will do
> the following:
> fromIntToString :: Int -> String
Is this a homework assignment, perchance? Please take a look at
Everyone here is glad to help, but we're also sensitive on academic
With that said, you've done the first step, which is writing down the
function's type. You don't want to iterate over all possible Int
values, so maybe a recursive definition is in order. What are the cases
to consider? Like, what happens if you have a negative number...
> this is a cast function to cast an Int to a String. I know such function
By the way, "cast" is probably the wrong word for what you want. You're
building a string representation of an Integer; in my view it's not "just"
a type conversion.
More information about the Haskell-Cafe