<commit_before>-----------------------------------------------------------------------------
-- |
-- Copyright   :  (C) 2014 <NAME>
-- License     :  BSD-style (see the file LICENSE)
-- Maintainer  :  <NAME> <<EMAIL>>
-- Stability   :  experimental
-- Portability :  portable
--
-- Simple string munging utilities
----------------------------------------------------------------------------
module Utils (joinOn, splitOn, strip, replace) where

import Data.Char (isSpace)
import Data.List (intersperse)
import Data.List.Split (splitOn)

joinOn :: [a] -> [[a]] -> [a]
joinOn x = concat . intersperse x

strip :: String -> String
strip = dropWhile isSpace . reverse . dropWhile isSpace . reverse

replace :: Eq a => [a] -> [a] -> [a] -> [a]
replace a b = joinOn b . splitOn a<commit_msg>add -Wall check for Utils<commit_after>{-# OPTIONS_GHC -Wall #-}
-----------------------------------------------------------------------------
-- |
-- Copyright   :  (C) 2014 <NAME>
-- License     :  BSD-style (see the file LICENSE)
-- Maintainer  :  <NAME> <<EMAIL>>
-- Stability   :  experimental
-- Portability :  portable
--
-- Simple string munging utilities
----------------------------------------------------------------------------
module Utils (joinOn, splitOn, strip, replace) where

import Data.Char (isSpace)
import Data.List (intersperse)
import Data.List.Split (splitOn)

joinOn :: [a] -> [[a]] -> [a]
joinOn x = concat . intersperse x

strip :: String -> String
strip = dropWhile isSpace . reverse . dropWhile isSpace . reverse

replace :: Eq a => [a] -> [a] -> [a] -> [a]
replace a b = joinOn b . splitOn a
{'fraction_non_alphanumeric': 0.31592039800995025, 'fraction_numerical': 0.004975124378109453, 'mean_word_length': 1.5744, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 25, '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': '1604077', 'n_tokens_mistral': 461, 'n_tokens_neox': 446, 'n_words': 147}