packages feed

pretty-simple 2.0.1.0 → 2.0.2.0

raw patch · 2 files changed

+188/−37 lines, 2 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Debug.Pretty.Simple: pTraceEventIONoColor :: String -> IO ()
+ Debug.Pretty.Simple: pTraceEventNoColor :: String -> a -> a
+ Debug.Pretty.Simple: pTraceIONoColor :: String -> IO ()
+ Debug.Pretty.Simple: pTraceIdNoColor :: String -> String
+ Debug.Pretty.Simple: pTraceMNoColor :: (Applicative f) => String -> f ()
+ Debug.Pretty.Simple: pTraceMarkerIONoColor :: String -> IO ()
+ Debug.Pretty.Simple: pTraceMarkerNoColor :: String -> a -> a
+ Debug.Pretty.Simple: pTraceNoColor :: String -> a -> a
+ Debug.Pretty.Simple: pTraceShowIdNoColor :: (Show a) => a -> a
+ Debug.Pretty.Simple: pTraceShowMNoColor :: (Show a, Applicative f) => a -> f ()
+ Debug.Pretty.Simple: pTraceShowNoColor :: (Show a) => a -> b -> b
+ Debug.Pretty.Simple: pTraceStackNoColor :: String -> a -> a

Files

pretty-simple.cabal view
@@ -1,5 +1,5 @@ name:                pretty-simple-version:             2.0.1.0+version:             2.0.2.0 synopsis:            pretty printer for data types with a 'Show' instance. description:         Please see <https://github.com/cdepillabout/pretty-simple#readme README.md>. homepage:            https://github.com/cdepillabout/pretty-simple
src/Debug/Pretty/Simple.hs view
@@ -19,8 +19,8 @@     pTrace   , pTraceId   , pTraceShow-  , pTraceIO   , pTraceShowId+  , pTraceIO   , pTraceM   , pTraceShowM   , pTraceStack@@ -28,13 +28,26 @@   , pTraceEventIO   , pTraceMarker   , pTraceMarkerIO+    -- * Trace without color+  , pTraceNoColor+  , pTraceIdNoColor+  , pTraceShowNoColor+  , pTraceShowIdNoColor+  , pTraceMNoColor+  , pTraceShowMNoColor+  , pTraceStackNoColor+  , pTraceEventNoColor+  , pTraceEventIONoColor+  , pTraceMarkerNoColor+  , pTraceMarkerIONoColor+  , pTraceIONoColor   ) where  import Data.Text.Lazy (unpack) import Debug.Trace-       (trace, traceIO, traceStack, traceEvent, traceEventIO, traceMarker,-        traceMarkerIO)-import Text.Pretty.Simple (pShow)+       (trace, traceEvent, traceEventIO, traceIO, traceM, traceMarker,+        traceMarkerIO, traceStack)+import Text.Pretty.Simple (pShow, pShowNoColor, pString, pStringNoColor)  #if __GLASGOW_HASKELL__ < 710 -- We don't need this import for GHC 7.10 as it exports all required functions@@ -49,7 +62,7 @@ @since 2.0.1.0 -} pTraceIO :: String -> IO ()-pTraceIO = traceIO . unpack . pShow+pTraceIO = traceIO . unpack . pString  {-| The 'pTrace' function pretty prints the trace message given as its first@@ -67,7 +80,7 @@ @since 2.0.1.0 -} pTrace :: String -> a -> a-pTrace = trace . unpack . pShow+pTrace = trace . unpack . pString  {-| Like 'pTrace' but returns the message instead of a third value.@@ -93,7 +106,7 @@ @since 2.0.1.0 -} pTraceShow :: (Show a) => a -> b -> b-pTraceShow = pTrace . show+pTraceShow = trace . unpack . pShow  {-| Like 'pTraceShow' but returns the shown value instead of a third value.@@ -101,7 +114,7 @@ @since 2.0.1.0 -} pTraceShowId :: (Show a) => a -> a-pTraceShowId a = pTrace (show a) a+pTraceShowId a = trace (unpack (pShow a)) a  {-| Like 'pTrace' but returning unit in an arbitrary 'Applicative' context. Allows@@ -122,8 +135,12 @@  @since 2.0.1.0 -}+#if __GLASGOW_HASKELL__ < 800+pTraceM :: (Monad f) => String -> f ()+#else pTraceM :: (Applicative f) => String -> f ()-pTraceM string = pTrace string $ pure ()+#endif+pTraceM string = trace (unpack (pString string)) $ pure ()  {-| Like 'pTraceM', but uses 'show' on the argument to convert it to a 'String'.@@ -136,8 +153,12 @@  @since 2.0.1.0 -}+#if __GLASGOW_HASKELL__ < 800+pTraceShowM :: (Show a, Monad f) => a -> f ()+#else pTraceShowM :: (Show a, Applicative f) => a -> f ()-pTraceShowM = pTraceM . show+#endif+pTraceShowM = traceM . unpack . pShow  {-| like 'pTrace', but additionally prints a call stack if one is@@ -152,7 +173,7 @@ @since 2.0.1.0 -} pTraceStack :: String -> a -> a-pTraceStack = traceStack . unpack . pShow+pTraceStack = traceStack . unpack . pString  {-| The 'pTraceEvent' function behaves like 'trace' with the difference that@@ -169,7 +190,7 @@ @since 2.0.1.0 -} pTraceEvent :: String -> a -> a-pTraceEvent = traceEvent . unpack . pShow+pTraceEvent = traceEvent . unpack . pString  {-| The 'pTraceEventIO' function emits a message to the eventlog, if eventlog@@ -181,34 +202,164 @@ @since 2.0.1.0 -} pTraceEventIO :: String -> IO ()-pTraceEventIO = traceEventIO . unpack . pShow+pTraceEventIO = traceEventIO . unpack . pString -{-|-The 'pTraceMarker' function 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.+-- | The 'pTraceMarker' function 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.+--+-- This function is suitable for use in pure code. In an IO context use+-- 'pTraceMarkerIO' instead.+--+-- Note that when using GHC's SMP runtime, it is possible (but rare) to get+-- duplicate events emitted if two CPUs simultaneously evaluate the same thunk+-- that uses 'pTraceMarker'.+--+-- @since 2.0.1.0+pTraceMarker :: String -> a -> a+pTraceMarker = traceMarker . unpack . pString -This function is suitable for use in pure code. In an IO context use-'pTraceMarkerIO' instead.+-- | The 'pTraceMarkerIO' function emits a marker to the eventlog, if eventlog+-- profiling is available and enabled at runtime.+--+-- Compared to 'pTraceMarker', 'pTraceMarkerIO' sequences the event with respect+-- to other IO actions.+--+-- @since 2.0.1.0+pTraceMarkerIO :: String -> IO ()+pTraceMarkerIO = traceMarkerIO . unpack . pString -Note that when using GHC's SMP runtime, it is possible (but rare) to get-duplicate events emitted if two CPUs simultaneously evaluate the same thunk-that uses 'pTraceMarker'.+------------------------------------------+-- Traces without color+------------------------------------------ -@since 2.0.1.0--}-pTraceMarker :: String -> a -> a-pTraceMarker = traceMarker . unpack . pShow+-- | Similar to 'pTrace', but without color.+--+-- >>> pTraceNoColor "wow" ()+-- wow+-- ()+--+-- @since 2.0.2.0+pTraceNoColor :: String -> a -> a+pTraceNoColor = trace . unpack . pStringNoColor -{--The 'pTraceMarkerIO' function emits a marker to the eventlog, if eventlog-profiling is available and enabled at runtime.+-- | Similar to 'pTraceId', but without color.+--+-- >>> pTraceIdNoColor "(1, 2, 3)" `seq` ()+-- ( 1+-- , 2+-- , 3+-- )+-- ()+--+-- @since 2.0.2.0+pTraceIdNoColor :: String -> String+pTraceIdNoColor a = pTraceNoColor a a -Compared to 'pTraceMarker', 'pTraceMarkerIO' sequences the event with respect to-other IO actions.+-- | Similar to 'pTraceShow', but without color.+--+-- >>> import qualified Data.Map as M+-- >>> pTraceShowNoColor (M.fromList [(1, True)]) ()+-- fromList+--     [+--         ( 1+--         , True+--         )+--     ]+-- ()+--+-- @since 2.0.2.0+pTraceShowNoColor :: (Show a) => a -> b -> b+pTraceShowNoColor = trace . unpack . pShowNoColor -@since 2.0.1.0--}-pTraceMarkerIO :: String -> IO ()-pTraceMarkerIO = traceMarkerIO . unpack . pShow+-- | Similar to 'pTraceShowId', but without color.+--+-- >>> import qualified Data.Map as M+-- >>> pTraceShowIdNoColor (M.fromList [(1, True)]) `seq` ()+-- fromList+--     [+--         ( 1+--         , True+--         )+--     ]+-- ()+--+-- @since 2.0.2.0+pTraceShowIdNoColor :: (Show a) => a -> a+pTraceShowIdNoColor a = trace (unpack (pShowNoColor a)) a++-- | Similar to 'pTraceM', but without color.+--+-- >>> pTraceMNoColor "wow"+-- wow+--+-- @since 2.0.2.0+#if __GLASGOW_HASKELL__ < 800+pTraceMNoColor :: (Monad f) => String -> f ()+#else+pTraceMNoColor :: (Applicative f) => String -> f ()+#endif+pTraceMNoColor string = trace (unpack (pString string)) $ pure ()++-- | Similar to 'pTraceShowM', but without color.+--+-- >>> pTraceShowMNoColor [1,2,3]+-- [ 1+-- , 2+-- , 3+-- ]+--+-- @since 2.0.2.0+#if __GLASGOW_HASKELL__ < 800+pTraceShowMNoColor :: (Show a, Monad f) => a -> f ()+#else+pTraceShowMNoColor :: (Show a, Applicative f) => a -> f ()+#endif+pTraceShowMNoColor = traceM . unpack . pShowNoColor++-- | Similar to 'pTraceStack', but without color.+--+-- >>> pTraceStackNoColor "wow" () `seq` ()+-- wow+-- ()+--+-- @since 2.0.2.0+pTraceStackNoColor :: String -> a -> a+pTraceStackNoColor = traceStack . unpack . pStringNoColor++-- | Similar to 'pTraceEvent', but without color.+--+-- @since 2.0.2.0+pTraceEventNoColor :: String -> a -> a+pTraceEventNoColor = traceEvent . unpack . pStringNoColor++-- | Similar to 'pTraceEventIO', but without color.+--+-- @since 2.0.2.0+pTraceEventIONoColor :: String -> IO ()+pTraceEventIONoColor = traceEventIO . unpack . pStringNoColor++-- | Similar to 'pTraceMarker', but without color.+--+-- @since 2.0.2.0+pTraceMarkerNoColor :: String -> a -> a+pTraceMarkerNoColor = traceMarker . unpack . pStringNoColor++-- | Similar to 'pTraceMarkerIO', but without color.+--+-- @since 2.0.2.0+pTraceMarkerIONoColor :: String -> IO ()+pTraceMarkerIONoColor = traceMarkerIO . unpack . pStringNoColor++-- | Similar to 'pTraceIO', but without color.+--+-- >>> pTraceIONoColor "(1, 2, 3)"+-- ( 1+-- , 2+-- , 3+-- )+--+-- @since 2.0.2.0+pTraceIONoColor :: String -> IO ()+pTraceIONoColor = traceIO . unpack . pStringNoColor