module Debug (
undefined,
error,
trace,
traceM,
traceId,
traceIO,
traceShow,
traceShowId,
traceShowM,
notImplemented,
) where
import Data.Text (Text, unpack)
import Control.Monad (Monad, return)
import qualified Base as P
import Show (Print, putStrLn)
import System.IO.Unsafe (unsafePerformIO)
trace :: Print b => b -> a -> a
trace string expr = unsafePerformIO (do
putStrLn string
return expr)
traceIO :: Print b => b -> a -> P.IO a
traceIO string expr = do
putStrLn string
return expr
error :: Text -> a
error s = P.error (unpack s)
traceShow :: P.Show a => a -> b -> b
traceShow a b = trace (P.show a) b
traceShowId :: P.Show a => a -> a
traceShowId a = trace (P.show a) a
traceShowM :: (P.Show a, Monad m) => a -> m ()
traceShowM a = trace (P.show a) (return ())
traceM :: (Monad m) => Text -> m ()
traceM s = trace (unpack s) (return ())
traceId :: Text -> Text
traceId s = trace s s
notImplemented :: a
notImplemented = P.error "Not implemented"
undefined :: a
undefined = P.undefined