
15 Jan
2010
15 Jan
'10
2:02 p.m.
On Fri, Jan 15, 2010 at 07:49:40PM +0100, Luca Ciciriello wrote:
Hi All.
in the function:
func :: String -> Int func str = read str
An absolute beginner as i am, want to use "read" to convert a String in a Int, but I don't know how to protect my function func from an exception when str is not a number like "12A". How can I do?
Thanks in advance for any answer to this my simply question.
I have tried to solve this problem too, and I ended up using the function "reads", which gives you back information about the parse status. Hope this helps, iustin