
I'm trying to play with a Yesod application. I had working code before, but tried stretching myself a bit and adding in some error checking. This code worked: getGoogR = do body <- simpleHttp "http://www.google.com" jsonToRepJson $ object ["response" .= (showDigest $ sha1 body)] This is the new code that is trying to use try (imported from Control.Exception) getGoogR = do body <- try (simpleHttp "http://www.google.com") :: IO (Either SomeException Data.ByteString.Lazy.Internal.ByteString) case body of Left _ -> jsonToRepJson $ object ["response" .= ( show "ERROR: NO DATA FOR ONE REASON OR ANOTHER")] Right val -> jsonToRepJson $ object ["response" .= (showDigest $ sha1 val)] and I get this error: Couldn't match expected type `IO b0' with actual type `GHandler sub0 master0 RepJson' In the expression: jsonToRepJson $ object ["response" .= (show "ERROR: NO DATA FOR ONE REASON OR ANOTHER")] In a case alternative: Left _ -> jsonToRepJson $ object ["response" .= (show "ERROR: NO DATA FOR ONE REASON OR ANOTHER")] In a stmt of a 'do' block: case body of { Left _ -> jsonToRepJson $ object ["response" .= (show "ERROR: NO DATA FOR ONE REASON OR ANOTHER")] Right val -> jsonToRepJson $ object ["response" .= (showDigest $ sha1 val)] I'm sure that my problem has a simple fix, but I just don't know what it is. I will be happy to share any other code if people ask, I'm just giving the short version for brevities sake. Thanks in advance, Bryce