<commit_before>module Shaker.TestTH
 where

import Shaker.Reflexivite
import Language.Haskell.TH
import Control.Monad.Reader
import Shaker.Cabal.CabalInfo

listProperties :: ExpQ 
listProperties = do
  modMaps <- runIO $ defaultCabalInput >>= runReaderT runReflexivite
  return $ ListE $ getQuickCheckProperty modMaps

getQuickCheckProperty :: [ModuleMapping] -> [Exp]
getQuickCheckProperty = concatMap getQuickCheckProperty'

getQuickCheckProperty' :: ModuleMapping -> [Exp]
getQuickCheckProperty' modMap = map (AppE (VarE (mkName "quickCheck") ) . VarE . mkName) $ cfPropName modMap

listHunit :: ExpQ 
listHunit = do 
  modMaps <- runIO $ defaultCabalInput >>= runReaderT runReflexivite
  return $ ListE $ getHunit modMaps
<commit_msg>Display property name with quickcheck result<commit_after>module Shaker.TestTH
 where

import Shaker.Reflexivite
import Language.Haskell.TH
import Control.Monad.Reader
import Shaker.Cabal.CabalInfo

listProperties :: ExpQ 
listProperties = do
  modMaps <- runIO $ defaultCabalInput >>= runReaderT runReflexivite
  return $ ListE $ getQuickCheckProperty modMaps

getQuickCheckProperty :: [ModuleMapping] -> [Exp]
getQuickCheckProperty = concatMap getQuickCheckProperty'

getQuickCheckProperty' :: ModuleMapping -> [Exp]
getQuickCheckProperty' modMap = map getSingleQuickCheck $ cfPropName modMap

getSingleQuickCheck :: String -> Exp
getSingleQuickCheck propName = DoE [NoBindS printName, NoBindS quickCall] 
  where quickCall = (AppE (VarE $ mkName "quickCheck" ) . VarE . mkName) propName
        printName = AppE (VarE $ mkName "putStrLn") (LitE (StringL propName)) 

listHunit :: ExpQ 
listHunit = do 
  modMaps <- runIO $ defaultCabalInput >>= runReaderT runReflexivite
  return $ ListE $ getHunit modMaps

{'fraction_non_alphanumeric': 0.08237986270022883, 'fraction_numerical': 0.0, 'mean_word_length': 5.406593406593407, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 16, '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': '6233690', 'n_tokens_mistral': 569, 'n_tokens_neox': 557, 'n_words': 141}