Please, can you help me with following?... I have a working code but am not very happy with the error handling in "updateStocks" function. It does what it should, but I would like to implement some kind of guards. Problem is that it always ends it some error + am not sure if I can use guards in inside defined variable. Pls. what would you suggest?



httpExceptionHandler ::  HttpException -> IO L.ByteString
httpExceptionHandler e = (putStrLn "Error: simpleHttp returned exception ") >> (return L.empty)

getStocks :: String -> IO L.ByteString
getStocks url = (simpleHttp url) `X.catch` httpExceptionHandler  

updateStocks :: IO String
updateStocks = do
  yqlResult <- getStocks testQuery
  case yqlResult of x | x == L.empty -> return "return exception"
                               | otherwise    -> return "here I will call another function"

thanks,
m.