diff options
Diffstat (limited to 'dput-hslogger')
-rw-r--r-- | dput-hslogger/src/DPut.hs | 8 |
1 files changed, 0 insertions, 8 deletions
diff --git a/dput-hslogger/src/DPut.hs b/dput-hslogger/src/DPut.hs index 38e532d0..7a0015b6 100644 --- a/dput-hslogger/src/DPut.hs +++ b/dput-hslogger/src/DPut.hs | |||
@@ -33,14 +33,6 @@ dputB tag msg = liftIO $ debugM (appName <.> show tag) (T.unpack . T.decodeUtf8 | |||
33 | verbosityMap :: IORef (Map.Map TypeRep Dynamic) | 33 | verbosityMap :: IORef (Map.Map TypeRep Dynamic) |
34 | verbosityMap = unsafePerformIO $ newIORef (Map.empty) | 34 | verbosityMap = unsafePerformIO $ newIORef (Map.empty) |
35 | 35 | ||
36 | -- | Trace version of 'dput' works in arbitrary monad, using unsafePerformIO. | ||
37 | tput :: (Applicative m, IsDebugTag tag) => tag -> String -> m () | ||
38 | tput tag msg = | ||
39 | let mp = unsafePerformIO $ readIORef verbosityMap | ||
40 | in if maybe True (fromMaybe True . Map.lookup tag . flip fromDyn Map.empty) (Map.lookup (typeOf tag) mp) | ||
41 | then trace msg (pure ()) | ||
42 | else pure () | ||
43 | |||
44 | -- | like 'trace' but parameterized with 'DebugTag' | 36 | -- | like 'trace' but parameterized with 'DebugTag' |
45 | dtrace :: forall a tag. IsDebugTag tag => tag -> String -> a -> a | 37 | dtrace :: forall a tag. IsDebugTag tag => tag -> String -> a -> a |
46 | dtrace tag msg result = let mp = unsafePerformIO $ readIORef verbosityMap | 38 | dtrace tag msg result = let mp = unsafePerformIO $ readIORef verbosityMap |