<commit_before>module DatabaseProcessing where

import Data.Time

data DatabaseItem = DbString String
                  | DbNumber Integer
                  | DbDate   UTCTime
                  deriving (Eq, Ord, Show)

theDatabase :: [DatabaseItem]
theDatabase = 
  [ DbDate (UTCTime 
            (fromGregorian 1911 5 1)
            (secondsToDiffTime 34123))
  , DbNumber 9001
  , DbString "Hello, World!"
  , DbDate (UTCTime
            (fromGregorian 1921 7 4)
            (secondsToDiffTime 34123))]

-- 1. filters for DbDate values and returns a 
-- list of UTCTime values inside them
filterDbDate :: [DatabaseItem] -> [UTCTime]
filterDbDate = undefined

-- 2. filters for DbNumber values and returns a
-- list of Integer values inside them
filterDbNumber :: [DatabaseItem] -> [Integer]
filterDbNumber = undefined

-- 3. Gets the most recent date
mostRecent :: [DatabaseItem] -> UTCTime<commit_msg>Problem 1<commit_after>module DatabaseProcessing where

import Data.Time

data DatabaseItem = DbString String
                  | DbNumber Integer
                  | DbDate   UTCTime
                  deriving (Eq, Ord, Show)

theDatabase :: [DatabaseItem]
theDatabase = 
  [ DbDate (UTCTime 
            (fromGregorian 1911 5 1)
            (secondsToDiffTime 34123))
  , DbNumber 9001
  , DbString "Hello, World!"
  , DbDate (UTCTime
            (fromGregorian 1921 7 4)
            (secondsToDiffTime 34123))]

-- 1. filters for DbDate values and returns a 
-- list of UTCTime values inside them
filterDbDate :: [DatabaseItem] -> [UTCTime]
filterDbDate = foldr filterDate []
  where 
    filterDate (DbDate x) acc = x : acc
    filterDate _          acc = acc 

-- 2. filters for DbNumber values and returns a
-- list of Integer values inside them
filterDbNumber :: [DatabaseItem] -> [Integer]
filterDbNumber = undefined

-- 3. Gets the most recent date
mostRecent :: [DatabaseItem] -> UTCTime
{'fraction_non_alphanumeric': 0.08149316508937961, 'fraction_numerical': 0.031019978969505785, 'mean_word_length': 2.5703564727954973, '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': '7369897', 'n_tokens_mistral': 630, 'n_tokens_neox': 529, 'n_words': 187}