Skip to content

Instantly share code, notes, and snippets.

@domenkozar
Created August 6, 2019 16:03
Show Gist options
  • Save domenkozar/a886d7de4cefaaa8c8d3a5d7bff6b0e5 to your computer and use it in GitHub Desktop.
Save domenkozar/a886d7de4cefaaa8c8d3a5d7bff6b0e5 to your computer and use it in GitHub Desktop.
{-# LANGUAGE ScopedTypeVariables #-}
import GHC.Stack
import Control.Exception
import Data.Functor
g :: HasCallStack => IO Bool
g = throwIO $ SomeException $ userError "foo"
f :: HasCallStack => IO ()
f = void $ g
main :: IO ()
main = catch f $ \(exc :: SomeException) -> print $ prettyCallStack callStack
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment