Created
August 22, 2012 22:19
-
-
Save sseveran/3430017 to your computer and use it in GitHub Desktop.
Exception Scoping 1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# 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) | |
`catch` | |
(\ 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