Skip to content

Instantly share code, notes, and snippets.

@phagenlocher
Last active May 2, 2020 11:19
Show Gist options
  • Select an option

  • Save phagenlocher/91fdbdfa5f12881830561da7424861a2 to your computer and use it in GitHub Desktop.

Select an option

Save phagenlocher/91fdbdfa5f12881830561da7424861a2 to your computer and use it in GitHub Desktop.
-- 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