Commit dccb90af authored by Simon Peyton Jones's avatar Simon Peyton Jones
Browse files

Add reportError and reportWarning to TH

...and deprecate plain 'report', which takes a Boolean flag whose
sense is hard to remember.

Thanks to Reiner Pope.
parent 18d48b49
......@@ -185,6 +185,15 @@ newName s = Q (qNewName s)
-- but carry on; use 'fail' to stop.
report :: Bool -> String -> Q ()
report b s = Q (qReport b s)
{-# DEPRECATED report "Use reportError or reportWarning instead" #-}
-- | Report an error to the user, but allow the current splice's computation to carry on. To abort the computation, use 'fail'.
reportError :: String -> Q ()
reportError = report True
-- | Report a warning to the user, and carry on.
reportWarning :: String -> Q ()
reportWarning = report False
-- | Recover from errors raised by 'reportError' or 'fail'.
recover :: Q a -- ^ handler to invoke on failure
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment