[commit: template-haskell] master: Add reportError and reportWarning to TH (8e504eb)

Simon Peyton Jones <[email protected]>
Newsgroups gmane.comp.lang.haskell.cvs.libraries
Message-ID <[email protected]>
Repository : ssh://darcs.haskell.org//srv/darcs/packages/template-haskell

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/8e504ebcd6d6a135e577a493f28663dabcfe6342

>---------------------------------------------------------------

commit 8e504ebcd6d6a135e577a493f28663dabcfe6342
Author: Simon Peyton Jones <[email protected]>
Date:   Mon Jul 16 17:44:49 2012 +0100

    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.

>---------------------------------------------------------------

 Language/Haskell/TH/Syntax.hs |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/Language/Haskell/TH/Syntax.hs b/Language/Haskell/TH/Syntax.hs
index 7c871e8..63421d1 100644
--- a/Language/Haskell/TH/Syntax.hs
+++ b/Language/Haskell/TH/Syntax.hs
@@ -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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.