<commit_before>#!/usr/local/bin/runhaskell

\begin{code}
import Distribution.Simple
main = defaultMain
\end{code}
<commit_msg>Make ./Setup.lhs test build the test program.<commit_after>#!/usr/local/bin/runhaskell

\begin{code}
import Distribution.Simple
import Distribution.Verbosity
import Distribution.Simple.LocalBuildInfo
import Distribution.PackageDescription
import Distribution.Simple.GHC as GHC
import Distribution.Simple.PreProcess

main = defaultMainWithHooks simpleUserHooks {runTests = buildTestProg}

buildTestProg :: [String] -> Bool -> PackageDescription -> LocalBuildInfo -> IO ()
buildTestProg _ _ pkgDescr lbi = do
    let newPkg = withTest pkgDescr
    preprocessSources newPkg lbi False normal [("hsc",ppHsc2hs)]
    GHC.build (withTest pkgDescr) lbi normal

withTest :: PackageDescription -> PackageDescription
withTest pkg@PackageDescription {library = Just lib} 
                = pkg {executables = [testProg],
                        library = Nothing}
    where
        testProg = Executable {exeName = "Test",
                                modulePath = "examples/Test.hs",
                                buildInfo = alterBuildInfo (libBuildInfo lib)}

alterBuildInfo :: BuildInfo -> BuildInfo
alterBuildInfo = id

\end{code}

{'fraction_non_alphanumeric': 0.08924302788844622, 'fraction_numerical': 0.0007968127490039841, 'mean_word_length': 3.3763066202090593, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '3035257', 'n_tokens_mistral': 365, 'n_tokens_neox': 348, 'n_words': 89}