{-# LANGUAGE TemplateHaskell #-}-- | see Debug.FileLocation module for more definitionsmoduleFileLocation(err,err',undef,fromJst,fromRht,indx,indxShow,debug,debugM,debugMsg,debugMsgIf,dbg,dbgMsg,trc,ltrace,ltraceM,strace,locationToString,thrwIO,thrwsIO,reThrow)whereimportFileLocation.LocationString(locationToString)importDebug.FileLocation(debug,debugM,debugMsg,dbg,dbgMsg,trc,ltrace,ltraceM,strace)importDebug.Util(debugMsgIf)importControl.Exception.FileLocation(thrwIO,thrwsIO,reThrow)importDebug.Trace(trace)importLanguage.Haskell.TH.SyntaximportLanguage.Haskell.TH(varE)importData.Maybe(fromMaybe)importqualifiedData.MapasM(lookup)-- | Like Prelude.error, but gives the file location.---- > $(err "OH NO!")-- > main:Main main.hs:4:10 OH NO!err::String->QExperrstr=doloc<-qLocationletprefix=(locationToStringloc)++" "[|error(prefix++str)|]-- | Like 'err', but the error message (to be appended to the location) is an argument of the generated expression.---- > $(err) "OH NO!"-- > main:Main main.hs:4:10 OH NO!err'::QExperr'=doloc<-qLocationletprefix=(locationToStringloc)++" "[|error.(prefix++)|]-- | Like Prelude.undefined, but gives the file location.---- Uses trace to output the location (this way we still use undefined instead of calling error).---- > $(undef)-- > main:Main main.hs:4:10 undefined-- > err: Prelude.undefinedundef::QExpundef=doloc<-qLocationletprefix=(locationToStringloc)++" "[|trace(prefix++"undefined")undefined|]-- | Like 'fromJust', but also shows the file location.fromJst::QExpfromJst=doloc<-qLocationletmsg=(locationToStringloc)++" fromJst: Nothing"[|\_m->case_mofJust_v->_vNothing->errormsg|]-- | Like 'fromRight', but also show the file location.fromRht::QExpfromRht=doloc<-qLocationletmsg=(locationToStringloc)++" fromRht: Left: "[|\_m->case_mofRight_v->_vLeft_e->error(msg++show_e)|]-- | Like @(flip ('Data.Map.!')@, but also shows the file location in case the element isn't found.indx::QExpindx=indx_commonFalse-- | Like 'indx', but also 'show's the looked-up element in case it isn't found.indxShow::QExpindxShow=indx_commonTrueindx_common::Bool->QExpindx_common=indxWith_common[|M.lookup|]indxWith_common::QExp->Bool->QExpindxWith_commonlookupEshowElt=doloc<-qLocationletmsg=(locationToStringloc)++" indx: Element not in the map"msgEvarName=ifshowEltthen[|msg++": "++show$(varEvarName)|]else[|msg|][|\_x_m->fromMaybe(error$(msgE'_x))($(lookupE)_x_m)|]