[project @ 2003-01-06 14:30:12 by ross]
authorross <unknown>
Mon, 6 Jan 2003 14:30:12 +0000 (14:30 +0000)
committerross <unknown>
Mon, 6 Jan 2003 14:30:12 +0000 (14:30 +0000)
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

index 19e8ac6..79d44c7 100644 (file)
@@ -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