I know how to throw an error in Haskell however I don't know how to do it for the read function. When I do something like this:
-- find the number on the second line of file/second list of strings
getNo :: String->Int
getNo inputBigString = read((listOfLines inputBigString) !! 1)
I want to specify like if the line you are trying to convert to an integer is empty/ or you can't convert it to an Integer then let me specify what error message to specify. At the moment if I input a file where the second line is empty it says
"Program error: Prelude.read: no parse"
but I want to be able to specify what error message should be shown myself - how can I accomplish this?