Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Exception Scoping 1
{-# LANGUAGE ScopedTypeVariables #-}
import Control.Exception
import Prelude hiding (catch)
iThrowExceptions :: Int
iThrowExceptions = error "I am a slippery exception"
data Record = Record Int deriving (Show)
main :: IO ()
main = do
val <- (return $ Just $ Record iThrowExceptions)
(\ e -> print (e :: SomeException) >> return Nothing)
print "The exception handler is now unwound off the stack."
print val
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.