Ticket #5469: 0003-Add-reportError-reportWarning.patch

File 0003-Add-reportError-reportWarning.patch, 1.1 KB (added by reinerp, 3 years ago)
  • Language/Haskell/TH/Syntax.hs

    From 0534969b8554481c921d53a4e3cface40223b439 Mon Sep 17 00:00:00 2001
    From: Reiner Pope <[email protected]>
    Date: Sat, 9 Jun 2012 16:36:55 +1000
    Subject: [PATCH 3/4] Add reportError, reportWarning.
    
    ---
     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 3d55f59..a6c4b53 100644
    a b newName s = Q (qNewName s) 
    184184-- but carry on; use 'fail' to stop.
    185185report  :: Bool -> String -> Q ()
    186186report b s = Q (qReport b s)
     187{-# DEPRECATED report "Use reportError or reportWarning instead" #-}
     188
     189-- | Report an error to the user, but allow the current splice's computation to carry on. To abort the computation, use 'fail'.
     190reportError :: String -> Q ()
     191reportError = report True
     192
     193-- | Report a warning to the user, and carry on.
     194reportWarning :: String -> Q ()
     195reportWarning = report False
    187196
    188197-- | Recover from errors raised by 'reportError' or 'fail'.
    189198recover :: Q a -- ^ handler to invoke on failure