Last active
May 2, 2020 11:19
-
-
Save phagenlocher/91fdbdfa5f12881830561da7424861a2 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| -- Compile with the -XScopedTypeVariables flag. | |
| -- e.g. ghc -Wall -XScopedTypeVariables Main.hs | |
| import Control.Exception | |
| data MyError = Error deriving Show | |
| instance Exception MyError | |
| failing :: IO () | |
| failing = do | |
| throw Error | |
| main :: IO () | |
| main = do | |
| catch failing (\(_ :: MyError) -> do | |
| putStrLn "Something went wrong!" | |
| ) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment