From 5c946766bcc713c0b503fc21f1e05a7042a07bfa Mon Sep 17 00:00:00 2001 From: Matthew Pickering Date: Fri, 19 Apr 2024 16:01:54 +0100 Subject: [PATCH] HEAD --- src/Plugin/TraceForeignCalls.hs | 14 +++++++------- src/Plugin/TraceForeignCalls/Instrument.hs | 5 +++-- trace-foreign-calls.cabal | 2 +- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/Plugin/TraceForeignCalls.hs b/src/Plugin/TraceForeignCalls.hs index d96c930..d7da3d2 100644 --- a/src/Plugin/TraceForeignCalls.hs +++ b/src/Plugin/TraceForeignCalls.hs @@ -173,7 +173,7 @@ mkWrapper (orig, renamed) sig = do return ( noLocA $ TypeSig - EpAnnNotUsed + noAnn [wrapperName] HsWC { hswc_ext = [] @@ -184,10 +184,10 @@ mkWrapper (orig, renamed) sig = do fun_ext = mkNameSet [unLoc renamed] -- TODO: what is this? , fun_id = wrapperName , fun_matches = MG { - mg_ext = Generated + mg_ext = Generated OtherExpansion SkipPmc , mg_alts = noLocA . map noLocA $ [ Match { - m_ext = EpAnnNotUsed + m_ext = noAnn , m_ctxt = FunRhs { mc_fun = wrapperName , mc_fixity = Prefix @@ -198,7 +198,7 @@ mkWrapper (orig, renamed) sig = do grhssExt = emptyComments , grhssGRHSs = map noLocA [ GRHS - EpAnnNotUsed + noAnn [] -- guards (noLocA $ HsDo @@ -248,7 +248,7 @@ mkWrapper (orig, renamed) sig = do NoExtField ( noLocA $ HsApp - EpAnnNotUsed + noExtField (noLocA $ HsVar NoExtField (noLocA returnMName)) (noLocA $ HsVar NoExtField result) ) @@ -262,9 +262,9 @@ mkWrapper (orig, renamed) sig = do NoExtField ( noLocA $ HsApp - EpAnnNotUsed + noExtField (noLocA $ HsVar NoExtField (noLocA traceEventIO)) - ( noLocA $ HsLit EpAnnNotUsed $ HsString NoSourceText $ + ( noLocA $ HsLit noExtField $ HsString NoSourceText $ fsLit $ label ++ wrapperNameString ) ) diff --git a/src/Plugin/TraceForeignCalls/Instrument.hs b/src/Plugin/TraceForeignCalls/Instrument.hs index 2a4799f..69b9fca 100644 --- a/src/Plugin/TraceForeignCalls/Instrument.hs +++ b/src/Plugin/TraceForeignCalls/Instrument.hs @@ -22,6 +22,7 @@ import Control.Monad.IO.Class import Control.Monad.Trans.Class import Control.Monad.Trans.Reader import Debug.Trace qualified +import qualified Language.Haskell.TH.Syntax as TH import GHC import GHC.Plugins @@ -115,10 +116,10 @@ data Names = Names { initNames :: TcM Names initNames = do - nameTraceEventIO <- resolveTHName 'Debug.Trace.traceEventIO + nameTraceEventIO <- resolveTHName (TH.mkNameG TH.VarName "ghc-internal" "GHC.Internal.Debug.Trace" "traceEventIO") return Names { nameTraceEventIO } findName :: (Names -> a) -> Instrument a -findName f = Wrap $ asks (f . tracerEnvNames) \ No newline at end of file +findName f = Wrap $ asks (f . tracerEnvNames) diff --git a/trace-foreign-calls.cabal b/trace-foreign-calls.cabal index 5900593..390a1b6 100644 --- a/trace-foreign-calls.cabal +++ b/trace-foreign-calls.cabal @@ -56,7 +56,7 @@ library build-depends: , exceptions >= 0.10 && < 0.11 , ghc >= 9.10 - , template-haskell >= 2.20 && < 2.21 + , template-haskell-next , transformers >= 0.6 && < 0.7 test-suite test-trace-foreign-calls