Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use traceEventIO, traceMarkerIO name (as in base).
- Loading branch information
Showing
1 changed file
with
21 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,49 @@ | ||
module Control.Monad.Class.MonadEventlog ( | ||
MonadEventlog(..) | ||
MonadEventlog(..), | ||
-- * Deprecated API | ||
traceEventM, | ||
traceMarkerM | ||
) where | ||
|
||
import Control.Monad.Reader | ||
import Debug.Trace (traceEventIO, traceMarkerIO) | ||
import qualified Debug.Trace as IO (traceEventIO, traceMarkerIO) | ||
|
||
class Monad m => MonadEventlog m where | ||
|
||
-- | Emits a message to the eventlog, if eventlog profiling is available and | ||
-- enabled at runtime. | ||
traceEventM :: String -> m () | ||
traceEventIO :: String -> m () | ||
|
||
-- | Emits a marker to the eventlog, if eventlog profiling is available and | ||
-- enabled at runtime. | ||
-- | ||
-- The 'String' is the name of the marker. The name is just used in the | ||
-- profiling tools to help you keep clear which marker is which. | ||
traceMarkerM :: String -> m () | ||
traceMarkerIO :: String -> m () | ||
|
||
|
||
traceEventM :: MonadEventlog m => String -> m () | ||
traceEventM = traceEventIO | ||
{-# DEPRECATED traceEventM "Use traceEventIO" #-} | ||
|
||
|
||
traceMarkerM :: MonadEventlog m => String -> m () | ||
traceMarkerM = traceMarkerIO | ||
{-# DEPRECATED traceMarkerM "Use traceEventIO" #-} | ||
|
||
|
||
-- | ||
-- Instances for IO | ||
-- | ||
|
||
instance MonadEventlog IO where | ||
traceEventM = traceEventIO | ||
traceMarkerM = traceMarkerIO | ||
traceEventIO = IO.traceEventIO | ||
traceMarkerIO = IO.traceMarkerIO | ||
|
||
-- | ||
-- Instance for ReaderT | ||
-- | ||
|
||
instance MonadEventlog m => MonadEventlog (ReaderT r m) where | ||
traceEventM = lift . traceEventM | ||
traceMarkerM = lift . traceMarkerM | ||
traceEventIO = lift . traceEventIO | ||
traceMarkerIO = lift . traceMarkerIO |