From 2b538bf568ecacd40514cabe567508cde14d3886 Mon Sep 17 00:00:00 2001 From: ross Date: Mon, 6 Jan 2003 14:30:12 +0000 Subject: [PATCH] [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. --- Debug/Trace.hs | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) 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 -- 1.7.10.4