Skip to content

Commit

Permalink
tehee
Browse files Browse the repository at this point in the history
  • Loading branch information
The1Penguin committed Oct 10, 2024
1 parent bd4a389 commit 014d6f2
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/Model.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{-# LANGUAGE FlexibleContexts, NumericUnderscores, OverloadedStrings #-}
{-# LANGUAGE LambdaCase #-}
module Model
( Restaurant(..)
, Menu(..)
Expand Down Expand Up @@ -99,13 +100,14 @@ removeOldLogs = do
now <- liftIO getCurrentTime
offset <- asks _cLogAge
path <- asks _cLogPath
files <- liftIO (listDirectory path) >>=
mapM (\s -> liftIO (getAccessTime s) <&> (s,)) . fmap ((path ++ "/") ++) >>=
liftIO (listDirectory path) >>=
mapM (\s -> liftIO (getAccessTime s) <&> (s,)) . (((path ++ "/") ++) <$>) >>=
filterM (pure . (<= (now & _utctDay %~ (.-^ offset))) . toThyme . snd) <&>
fmap fst
timestamp ("Removing the following files:" <+> prettyList files) >>=
logMessage >>
liftIO (mapM_ removeFile files)
(fst <$>) >>= \case
[] -> pure ()
files -> timestamp ("Removing the following files:" <+> prettyList files) >>=
logMessage >>
liftIO (mapM_ removeFile files)

update
:: ( MonadIO m
Expand Down

0 comments on commit 014d6f2

Please sign in to comment.