<commit_before>{-# LANGUAGE CPP #-}
{-# LANGUAGE DeriveDataTypeable        #-}
{-# LANGUAGE NoMonomorphismRestriction #-}
{-# LANGUAGE OverloadedStrings         #-}
{-# LANGUAGE ScopedTypeVariables       #-}
{-# LANGUAGE TupleSections             #-}
{-# LANGUAGE ImplicitParams            #-}

module Language.Fixpoint.Misc where

import           Control.Exception                (catch, IOException, bracket_)
import           Data.Hashable
import           Data.Traversable                 (traverse)
import           Control.Applicative              ((<$>))
import           Control.Arrow                    (first, second)
import           Control.Monad                    (forM_, (>=>))
import qualified Data.HashMap.Strict              as M
import qualified Data.List                        as L
import           Data.Tuple                       (swap)
import           Data.Maybe                       (fromJust, catMaybes, fromMaybe)
import qualified Data.Text                        as T

import           Data.Data                        (Data, Typeable)
import           Debug.Trace                      (trace)
import           System.Console.ANSI
import           System.Console.CmdArgs.Verbosity (whenLoud)
import           System.Exit                      (ExitCode (..))
import           System.Process                   (system)

import           Text.PrettyPrint.HughesPJ        hiding (first)

#ifdef MIN_VERSION_located_base
import Prelude hiding (error, undefined)
import GHC.Err.Located
import GHC.Stack
#endif


-----------------------------------------------------------------------------------
------------ Support for Colored Logging ------------------------------------------
-----------------------------------------------------------------------------------

data Moods = Ok | Loud | Sad | Happy | Angry

moodColor Ok    = Black
moodColor Loud  = Blue
moodColor Sad   = Magenta
moodColor Happy = Green
moodColor Angry = Red

wrapStars msg = "\n**** " ++ msg ++ " " ++ replicate (74 - length msg) '*'

-- withColor _ act = act
withColor c act<commit_msg>restore traceShow<commit_after>{-# LANGUAGE CPP #-}
{-# LANGUAGE DeriveDataTypeable        #-}
{-# LANGUAGE NoMonomorphismRestriction #-}
{-# LANGUAGE OverloadedStrings         #-}
{-# LANGUAGE ScopedTypeVariables       #-}
{-# LANGUAGE TupleSections             #-}
{-# LANGUAGE ImplicitParams            #-}

module Language.Fixpoint.Misc where

import           Control.Exception                (catch, IOException, bracket_)
import           Data.Hashable
import           Data.Traversable                 (traverse)
import           Control.Applicative              ((<$>))
import           Control.Arrow                    (first, second)
import           Control.Monad                    (forM_, (>=>))
import qualified Data.HashMap.Strict              as M
import qualified Data.List                        as L
import           Data.Tuple                       (swap)
import           Data.Maybe                       (fromJust, catMaybes, fromMaybe)
import qualified Data.Text                        as T

import           Data.Data                        (Data, Typeable)
import           Debug.Trace                      (trace)
import           System.Console.ANSI
import           System.Console.CmdArgs.Verbosity (whenLoud)
import           System.Exit                      (ExitCode (..))
import           System.Process                   (system)

import           Text.PrettyPrint.HughesPJ        hiding (first)

#ifdef MIN_VERSION_located_base
import Prelude hiding (error, undefined)
import GHC.Err.Located
import GHC.Stack
#endif



traceShow     ::  Show a => String -> a -> a
traceShow s x = trace ("\nTrace: [" ++ s ++ "] : " ++ show x)  x


-----------------------------------------------------------------------------------
------------ Support for Colored Logging ------------------------------------------
-----------------------------------------------------------------------------------

data Moods = Ok | Loud | Sad | Happy | Angry

moodColor Ok    = Black
moodColor Loud  = Blue
moodColor Sad   = Magenta
moodColor Happy = Green
moodColor Angry = Red

wrapStars msg = "\n**** " ++ msg ++ " " ++ replicate (74 - length msg) '*'

-- withColor _ act = act
withColor c act
{'fraction_non_alphanumeric': 0.18343057176196031, 'fraction_numerical': 0.0009334889148191366, 'mean_word_length': 1.2569773565034228, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 12, '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': '6248922', 'n_tokens_mistral': 1088, 'n_tokens_neox': 1045, 'n_words': 283}