Added HasCallStack constraint for trace functions (#55)

* added HasCallStack constraint for trace functions, for issue #39

* unpack string on 7.6
This commit is contained in:
Stephen Diehl
2017-05-31 10:13:08 +01:00
committed by GitHub
parent c2570f77e6
commit 46220a1a4a
7 changed files with 75 additions and 14 deletions
+3 -7
View File
@@ -3,7 +3,6 @@
module Debug (
undefined,
error,
trace,
traceM,
traceId,
@@ -18,6 +17,7 @@ import Data.Text (Text, unpack)
import Control.Monad (Monad, return)
import qualified Base as P
import Error (error)
import Show (Print, putStrLn)
import System.IO.Unsafe (unsafePerformIO)
@@ -34,10 +34,6 @@ traceIO string expr = do
putStrLn string
return expr
{-# WARNING error "'error' remains in code" #-}
error :: Text -> a
error s = P.error (unpack s)
{-# WARNING traceShow "'traceShow' remains in code" #-}
traceShow :: P.Show a => a -> b -> b
traceShow a b = trace (P.show a) b
@@ -59,7 +55,7 @@ traceId :: Text -> Text
traceId s = trace s s
notImplemented :: a
notImplemented = P.error "Not implemented"
notImplemented = error "Not implemented"
undefined :: a
undefined = P.undefined
undefined = error "Prelude.undefined"