<commit_before>module Handler.Root (getRootR) where

import Import
import Control.Monad (forM)
import Data.Time.Format.Human
import Helpers.Post
import Yesod.Links

getRootR :: Handler RepHtml
getRootR = do
    -- select 5 recent (Post, [Tag]) records
    records <- runDB $ do
        posts <- selectList [] [Desc PostDate, LimitTo 5]

        let pids = map entityKey posts
        tags <- selectList [TagPost <-. pids] []

        forM posts $ \post -> do
            let pid   = entityKey post
            let post' = entityVal post
            let tags' = filter ((== pid) . tagPost) $ map entityVal tags

            return (post', tags')
<commit_msg>-Wall<commit_after>module Handler.Root (getRootR) where

import Import
import Control.Monad (forM)
import Helpers.Post
import Yesod.Links

getRootR :: Handler RepHtml
getRootR = do
    -- select 5 recent (Post, [Tag]) records
    records <- runDB $ do
        posts <- selectList [] [Desc PostDate, LimitTo 5]

        let pids = map entityKey posts
        tags <- selectList [TagPost <-. pids] []

        forM posts $ \post -> do
            let pid   = entityKey post
            let post' = entityVal post
            let tags' = filter ((== pid) . tagPost) $ map entityVal tags

            return (post', tags')

{'fraction_non_alphanumeric': 0.10188087774294671, 'fraction_numerical': 0.003134796238244514, 'mean_word_length': 2.2493638676844783, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 5, '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': '2680538', 'n_tokens_mistral': 390, 'n_tokens_neox': 365, 'n_words': 132}