Skip to content

Instantly share code, notes, and snippets.

@sseveran
Created August 22, 2012 22:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sseveran/3430089 to your computer and use it in GitHub Desktop.
Save sseveran/3430089 to your computer and use it in GitHub Desktop.
Exception Scoping 3
safeCatch :: (Exception e, NFData a) => IO a -> (e -> IO a) -> IO a
safeCatch func handler = catch eval handler where
eval = do
x <- func
rnf x `seq` return $! x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment