
-- Hugs/GHC incompatibility work-arounds.  Hugs version.

module Compatibility ( double2Float, trace, hSetBuffering, 
                       yield,
		       debugMsgLn, setDebug, mkWeakIORef)
where
import Addr (Addr)
import IOExts
import Weak
import Monad

mkWeakIORef :: IORef a -> IO () -> IO (Weak (IORef a))
mkWeakIORef ref final = mkWeakPtr ref (Just final)

debugRef :: IORef Bool
debugRef = unsafePerformIO $ newIORef False

setDebug :: Bool -> IO ()
setDebug b = writeIORef debugRef b

debugMsgLn :: String -> IO ()
debugMsgLn s  = do
 b <- readIORef debugRef
 when b $ putStrLn s

yield = runAllFinalizers

hSetBuffering _ _ = return ()

double2Float :: Double -> Float
double2Float = fromDouble




