Hi Tsun,
some details regarding my question. I got this assignment which gives me the following: SomeFunction :: Integer -> String. Which uses the show function to convert the Integer to String.
However it asks me how my function can fail?
I want to know how, given the function's type, it can fail. This is particular to your definition. This is different from using the function on an expected type. That is not a case of the function failing but a case of the typechecker telling you the program is invalid.
Are there any values of Integer for which showCC produces an unexpected output? What about negative numbers, large numbers, etc? What does your function do for these cases?
I didn't ask you to do any error checking, so instead, I want you to tell me the limits of your function definition.
Now I also know that when I use 'undefined' I would get an error. So what other cases are there? (I asked my question about Floating because I guessed it would be similiar to Integers)
The function is strict, so undefined would cause it to fail. I'm not really concerned with that kind of answer, because we aren't working with these values in the course, yet.
At this moment I really can't figure out how my function can fail other than the inputs described above.
AFAIKT, you just mentioned Float. This is a type mismatch, not a case in which showCC fails or provides unexpected output.
Thanks for your help!