<commit_before>module Main where

import           Control.Applicative
import           Data.Aeson
import qualified Data.ByteString.Lazy     as BS
import qualified Data.ByteString.Char8    as C8
import           Network.Wai.Handler.Warp
import           System.Exit              ( exitFailure )
import           System.IO

import           GitMail.Queue
import           GitMail.Github
import           GitMail.App              ( app, newAppState )

secrets = "secrets.json"

main = do
    mconf <- withFile secrets ReadMode $ \h ->
        decode . BS.fromStrict <$> C8.hGetContents h

    conf <- case mconf of
        Nothing -> do
            putStrLn $ "Failed to parse " ++ secrets
            exitFailure >> undefined -- for typechecking purposes
        Just x -> return x

    state <- newAppState

    run 8080 $ app conf state<commit_msg>switch to port 8000 for github service<commit_after>module Main where

import           Control.Applicative
import           Data.Aeson
import qualified Data.ByteString.Lazy     as BS
import qualified Data.ByteString.Char8    as C8
import           Network.Wai.Handler.Warp
import           System.Exit              ( exitFailure )
import           System.IO

import           GitMail.Queue
import           GitMail.Github
import           GitMail.App              ( app, newAppState )

secrets = "secrets.json"

main = do
    mconf <- withFile secrets ReadMode $ \h ->
        decode . BS.fromStrict <$> C8.hGetContents h

    conf <- case mconf of
        Nothing -> do
            putStrLn $ "Failed to parse " ++ secrets
            exitFailure >> undefined -- for typechecking purposes
        Just x -> return x

    state <- newAppState

    run 8000 $ app conf state
{'fraction_non_alphanumeric': 0.0661636680208938, 'fraction_numerical': 0.01044689495066744, 'mean_word_length': 1.8123980424143555, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 15, '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': '6229429', 'n_tokens_mistral': 486, 'n_tokens_neox': 453, 'n_words': 149}