From: ross Date: Mon, 6 Jan 2003 14:30:12 +0000 (+0000) Subject: [project @ 2003-01-06 14:30:12 by ross] X-Git-Tag: nhc98-1-18-release~765 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=2b538bf568ecacd40514cabe567508cde14d3886;p=haskell-directory.git [project @ 2003-01-06 14:30:12 by ross] Consolidate to a single version of trace (except that GHC has the post-hook). This version adds a newline, which the old Hugs and NHC versions didn't. --- diff --git a/Debug/Trace.hs b/Debug/Trace.hs index 19e8ac6..79d44c7 100644 --- a/Debug/Trace.hs +++ b/Debug/Trace.hs @@ -26,11 +26,6 @@ import GHC.IOBase import GHC.Handle #endif -#ifdef __HUGS__ -import Hugs.IOExts -#endif - -#ifdef __GLASGOW_HASKELL__ {-# NOINLINE trace #-} {-| When called, 'trace' prints the string in its first argument to @@ -44,14 +39,12 @@ trace :: String -> a -> a trace string expr = unsafePerformIO $ do hPutStr stderr string hPutChar stderr '\n' +#ifdef __GLASGOW_HASKELL__ fd <- withHandle_ "trace" stderr $ (return.haFD) postTraceHook fd +#endif return expr +#ifdef __GLASGOW_HASKELL__ foreign import ccall "PostTraceHook" postTraceHook :: Int -> IO () #endif - -#ifdef __NHC__ -trace :: String -> a -> a -trace str expr = unsafePerformIO $ do hPutStr stderr str; return expr -#endif