Create a gist now

Instantly share code, notes, and snippets.

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