<commit_before>{-# LANGUAGE CPP #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE OverloadedStrings #-}

module DataAnalysis.Application.Prelude
  (runAnalysisApp)
  where

import Data.Proxy (Proxy)
import Data.Text (Text)
import Yesod
import Yesod.Static

#ifdef FPHC
import Network.HTTP.Conduit (Manager, newManager, def)
defaultManagerSettings = def
#else
import Network.HTTP.Client (defaultManagerSettings, newManager)
#endif

import DataAnalysis.Application.Types
import DataAnalysis.Application.Dispatch ()

-- | Run the analysis web app.
runAnalysisApp :: HasAnalysis params => Text -> Proxy params -> IO ()
runAnalysisApp title params = do
  s <- static "static"
  man <- newManager defaultManagerSettings
  warpEnv
    (App man
         title
         (getSomeAnalysis params)
         s)
<commit_msg>Make sure ifdef'd imports come last<commit_after>{-# LANGUAGE CPP #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE OverloadedStrings #-}

module DataAnalysis.Application.Prelude
  (runAnalysisApp)
  where

import Data.Proxy (Proxy)
import Data.Text (Text)
import Yesod
import Yesod.Static

import DataAnalysis.Application.Types
import DataAnalysis.Application.Dispatch ()

#ifdef FPHC
import Network.HTTP.Conduit (Manager, newManager, def)
defaultManagerSettings = def
#else
import Network.HTTP.Client (defaultManagerSettings, newManager)
#endif

-- | Run the analysis web app.
runAnalysisApp :: HasAnalysis params => Text -> Proxy params -> IO ()
runAnalysisApp title params = do
  s <- static "static"
  man <- newManager defaultManagerSettings
  warpEnv
    (App man
         title
         (getSomeAnalysis params)
         s)

{'fraction_non_alphanumeric': 0.1020293122886133, 'fraction_numerical': 0.0, 'mean_word_length': 4.130057803468208, 'pattern_counts': {'":': 0, '<': 7, '<?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': '4934487', 'n_tokens_mistral': 551, 'n_tokens_neox': 545, 'n_words': 151}