-- -- Pure Haskell line/column numbers in a trace message. -- -- Copyright 2006 Don Stewart -- -- Free for any use. -- module Exception (locatedError, assert) where import qualified Control.Exception as C (catch) import System.IO.Unsafe (unsafePerformIO) import GHC.Base (assert) import System.IO locatedError :: Assert a -> String -> a locatedError assrt str = unsafePerformIO $ C.catch (assrt False $ return undefined) prettyError where prettyError e = let (x,_) = break (== ' ') $ show e in error (x ++ " " ++ str) type Assert a = Bool -> IO a -> IO a