
27 Oct
2010
27 Oct
'10
2:45 a.m.
I have a pure value which may throw errors when it is evaluated in an IO monad. My code to handle it looks like this: temp <- try $ evaluate value case temp of Left (error::ErrorCall) -> scoldTheUserAndTryAgain Right correct -> doSomething Can this be done without the temporary variable, or with less plumbing? I tried lifting either, but GHC was fussing about ambiguous types, appending a signature to a pattern match is no longer allowed(?), and it didn't look that much cleaner.