{-# LANGUAGE CPP, NoImplicitPrelude #-}
module Debug.Trace.Compat (
module Base
, traceId
, traceShowId
, traceM
, traceShowM
, traceWith
, traceShowWith
#if MIN_VERSION_base(4,5,0)
, traceEventWith
#endif
) where
#if !(MIN_VERSION_base(4,7,0)) || MIN_VERSION_base(4,9,0)
import Debug.Trace as Base
#else
import Debug.Trace as Base hiding (
traceM
, traceShowM
)
#endif
#if !(MIN_VERSION_base(4,18,0))
import Prelude.Compat
#endif
#if !(MIN_VERSION_base(4,7,0))
traceId :: String -> String
traceId a = trace a a
traceShowId :: (Show a) => a -> a
traceShowId a = trace (show a) a
#endif
#if !(MIN_VERSION_base(4,9,0))
traceM :: (Applicative f) => String -> f ()
traceM string = trace string $ pure ()
traceShowM :: (Show a, Applicative f) => a -> f ()
traceShowM = traceM . show
#endif
#if !(MIN_VERSION_base(4,18,0))
traceWith :: (a -> String) -> a -> a
traceWith :: forall a. (a -> String) -> a -> a
traceWith a -> String
f a
a = forall a. String -> a -> a
trace (a -> String
f a
a) a
a
traceShowWith :: Show b => (a -> b) -> a -> a
traceShowWith :: forall b a. Show b => (a -> b) -> a -> a
traceShowWith a -> b
f = forall a. (a -> String) -> a -> a
traceWith (forall a. Show a => a -> String
show forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> b
f)
# if MIN_VERSION_base(4,5,0)
traceEventWith :: (a -> String) -> a -> a
traceEventWith :: forall a. (a -> String) -> a -> a
traceEventWith a -> String
f a
a = forall a. String -> a -> a
traceEvent (a -> String
f a
a) a
a
# endif
#endif