{-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE OverloadedStrings #-} module Precursor.Debug ( undefined , trace , traceShow , notImplemented ) where import Precursor.Control.Functor import Precursor.System.IO import Prelude (error, undefined) import System.IO.Unsafe (unsafePerformIO) import Precursor.Text.Text import Precursor.Text.Show {-# WARNING trace "'trace' remains in code" #-} -- | Used for tracing a message along with a pure value. For debugging -- purposes only. trace :: Text -> b -> b trace msg x = unsafePerformIO (putStrLn msg $> x) {-# WARNING notImplemented "'notImplemented' remains in code" #-} -- | Used to fill in holes in code for later implementation. notImplemented :: a notImplemented = error "Not implemented" {-# WARNING traceShow "'traceShow' remains in code" #-} -- | Prints a value to stdout when it's evaluated. For debugging -- purposes only. traceShow :: TextShow a => a -> a traceShow x = trace (show x) x