{-# LANGUAGE Trustworthy #-} {-# LANGUAGE NoImplicitPrelude #-} {-# OPTIONS_GHC -fno-warn-warnings-deprecations #-} module Protolude.Debug ( undefined, trace, traceM, traceId, traceIO, traceShow, traceShowId, traceShowM, notImplemented, witness, ) where import Data.Text (Text, unpack) import Control.Monad (Monad, return) import qualified Protolude.Base as P import Protolude.Error (error) import Protolude.Show (Print, hPutStrLn) import System.IO(stderr) import System.IO.Unsafe (unsafePerformIO) {-# WARNING trace "'trace' remains in code" #-} trace :: Print b => b -> a -> a trace :: forall b a. Print b => b -> a -> a trace b string a expr = IO a -> a forall a. IO a -> a unsafePerformIO (do Handle -> b -> IO () forall a (m :: * -> *). (Print a, MonadIO m) => Handle -> a -> m () forall (m :: * -> *). MonadIO m => Handle -> b -> m () hPutStrLn Handle stderr b string a -> IO a forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return a expr) {-# WARNING traceIO "'traceIO' remains in code" #-} traceIO :: Print b => b -> a -> P.IO a traceIO :: forall b a. Print b => b -> a -> IO a traceIO b string a expr = do Handle -> b -> IO () forall a (m :: * -> *). (Print a, MonadIO m) => Handle -> a -> m () forall (m :: * -> *). MonadIO m => Handle -> b -> m () hPutStrLn Handle stderr b string a -> IO a forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return a expr {-# WARNING traceShow "'traceShow' remains in code" #-} traceShow :: P.Show a => a -> b -> b traceShow :: forall a b. Show a => a -> b -> b traceShow a a b b = String -> b -> b forall b a. Print b => b -> a -> a trace (a -> String forall a. Show a => a -> String P.show a a) b b {-# WARNING traceShowId "'traceShowId' remains in code" #-} traceShowId :: P.Show a => a -> a traceShowId :: forall a. Show a => a -> a traceShowId a a = String -> a -> a forall b a. Print b => b -> a -> a trace (a -> String forall a. Show a => a -> String P.show a a) a a {-# WARNING traceShowM "'traceShowM' remains in code" #-} traceShowM :: (P.Show a, Monad m) => a -> m () traceShowM :: forall a (m :: * -> *). (Show a, Monad m) => a -> m () traceShowM a a = String -> m () -> m () forall b a. Print b => b -> a -> a trace (a -> String forall a. Show a => a -> String P.show a a) (() -> m () forall a. a -> m a forall (m :: * -> *) a. Monad m => a -> m a return ()) {-# WARNING traceM "'traceM' remains in code" #-} traceM :: (Monad m) => Text -> m () traceM :: forall (m :: * -> *). Monad m => Text -> m () traceM Text s = String -> m () -> m () forall b a. Print b => b -> a -> a trace (Text -> String unpack Text s) (() -> m () forall a. a -> m a forall (m :: * -> *) a. Monad m => a -> m a return ()) {-# WARNING traceId "'traceId' remains in code" #-} traceId :: Text -> Text traceId :: Text -> Text traceId Text s = Text -> Text -> Text forall b a. Print b => b -> a -> a trace Text s Text s {-# WARNING notImplemented "'notImplemented' remains in code" #-} notImplemented :: a notImplemented :: forall a. a notImplemented = Text -> a forall a. HasCallStack => Text -> a error Text "Not implemented" {-# WARNING undefined "'undefined' remains in code" #-} undefined :: a undefined :: forall a. a undefined = Text -> a forall a. HasCallStack => Text -> a error Text "Prelude.undefined" witness :: a witness :: forall a. a witness = Text -> a forall a. HasCallStack => Text -> a error Text "Type witness should not be evaluated"