<commit_before>-----------------------------------------------------------------------------
-- |
-- Module      :  Debug.Trace
-- Copyright   :  (c) The University of Glasgow 2001
-- License     :  BSD-style (see the file libraries/base/LICENSE)
-- 
-- Maintainer  :  <EMAIL>
-- Stability   :  provisional
-- Portability :  portable
--
-- The 'trace' function.
--
-----------------------------------------------------------------------------

module Debug.Trace (
	-- * Tracing
	putTraceMsg,      -- :: String -> IO ()
	trace             -- :: String -> a -> a
  ) where

import Prelude
import System.IO.Unsafe

#ifdef __GLASGOW_HASKELL__
#ifdef mingw32_HOST_OS
import Foreign.C.String
#endif
#endif

-- | 'putTraceMsg' function outputs the trace message from IO monad.
-- Usually the output stream is 'stderr' but if the function is called
-- from Windows GUI application then the output will be directed to the Windows
-- debug console.
putTraceMsg :: String -> IO ()
putTraceMsg msg = do
#ifndef __GLASGOW_HASKELL__
    hPutStr handle msg<commit_msg>[project @ 2005-01-29 16:10:27 by wolfgang] import CString on non-windows platforms.<commit_after>-----------------------------------------------------------------------------
-- |
-- Module      :  Debug.Trace
-- Copyright   :  (c) The University of Glasgow 2001
-- License     :  BSD-style (see the file libraries/base/LICENSE)
-- 
-- Maintainer  :  <EMAIL>
-- Stability   :  provisional
-- Portability :  portable
--
-- The 'trace' function.
--
-----------------------------------------------------------------------------

module Debug.Trace (
	-- * Tracing
	putTraceMsg,      -- :: String -> IO ()
	trace             -- :: String -> a -> a
  ) where

import Prelude
import System.IO.Unsafe

#ifdef __GLASGOW_HASKELL__
import Foreign.C.String
#endif

-- | 'putTraceMsg' function outputs the trace message from IO monad.
-- Usually the output stream is 'stderr' but if the function is called
-- from Windows GUI application then the output will be directed to the Windows
-- debug console.
putTraceMsg :: String -> IO ()
putTraceMsg msg = do
#ifndef __GLASGOW_HASKELL__
    hPutStr handle msg
{'fraction_non_alphanumeric': 0.23871568171242438, 'fraction_numerical': 0.011167985109353188, 'mean_word_length': 1.707808564231738, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5123970', 'n_tokens_mistral': 602, 'n_tokens_neox': 576, 'n_words': 195}