diff --git a/lib/Shower/Trace.hs b/lib/Shower/Trace.hs new file mode 100644 index 0000000..3ef2e17 --- /dev/null +++ b/lib/Shower/Trace.hs @@ -0,0 +1,23 @@ +-- | Wrappers for Debug.Trace functions with a nicer layout. + +module Shower.Trace + ( traceShower, + traceShowerId, + traceShowerWith, + traceShowerM + ) where + +import Debug.Trace +import Shower (shower) + +traceShower :: Show a => a -> b -> b +traceShower = trace . shower + +traceShowerId :: Show a => a -> a +traceShowerId x = trace (shower x) x + +traceShowerWith :: Show b => (a -> b) -> a -> a +traceShowerWith f x = trace (shower $ f x) x + +traceShowerM :: (Show a, Monad m) => a -> m () +traceShowerM = traceM . shower diff --git a/shower.cabal b/shower.cabal index 29397e2..bb2499e 100644 --- a/shower.cabal +++ b/shower.cabal @@ -1,5 +1,5 @@ name: shower -version: 0.2.0.3 +version: 0.2.0.4 synopsis: Clean up the formatting of 'show' output -- description: license: BSD3 @@ -24,6 +24,7 @@ source-repository head library exposed-modules: Shower + Shower.Trace Shower.Printer Shower.Parser Shower.Class