aboutsummaryrefslogtreecommitdiffstats
path: root/app/History.hs
diff options
context:
space:
mode:
authorLibravatar Alexander Foremny <aforemny@posteo.de>2023-10-17 14:54:54 +0200
committerLibravatar Alexander Foremny <aforemny@posteo.de>2023-10-17 14:54:55 +0200
commit737aec8c1f31077b1a4e1ada1e33d25c1612fec8 (patch)
treed29faca037699387c154c7ab08614f2d79f2f861 /app/History.hs
parent0be5453f8bb50dd491bedd856d9625c5b5585148 (diff)
inline `cached` into function calls
Diffstat (limited to 'app/History.hs')
-rw-r--r--app/History.hs12
1 files changed, 6 insertions, 6 deletions
diff --git a/app/History.hs b/app/History.hs
index 7ed09bc..002ca32 100644
--- a/app/History.hs
+++ b/app/History.hs
@@ -40,8 +40,8 @@ listEvents = do
case commitHashes of
[] -> pure []
hashFirst : hashesRest -> do
- issuesInitial <- cached (append hashFirst (pack ".all")) (\_ -> getIssuesCommitAll hashFirst)
- commitInfos <- mapM (\hash -> cached (append hash (pack ".changed")) (\_ -> getCommitInfo hash)) hashesRest
+ issuesInitial <- getIssuesCommitAll hashFirst
+ commitInfos <- mapM getCommitInfo hashesRest
commitInfoWorkingTree <- getCommitInfoWorkingTree []
let eventses = getEvents hashFirst issuesInitial (commitInfos ++ [commitInfoWorkingTree])
pure eventses
@@ -67,8 +67,8 @@ listIssues sort filters paths = do
-- complete issue text and parse it.
--
-- @topic caching
- issuesInitial <- cached (append hashFirst (pack ".all")) (\_ -> getIssuesCommitAll hashFirst)
- commitInfos <- mapM (\hash -> cached (append hash (pack ".changed")) (\_ -> getCommitInfo hash)) hashesRest
+ issuesInitial <- getIssuesCommitAll hashFirst
+ commitInfos <- mapM getCommitInfo hashesRest
commitInfoWorkingTree <- getCommitInfoWorkingTree paths
let eventses = getEvents hashFirst issuesInitial (commitInfos ++ [commitInfoWorkingTree])
let issues = mapMaybe issueFromIssueEvents eventses
@@ -124,7 +124,7 @@ data CommitInfo = CommitInfo
deriving (Show, Binary, Generic)
getCommitInfo :: Text -> IO CommitInfo
-getCommitInfo hash = do
+getCommitInfo hash = cached (append hash (pack ".changed")) $ \_ -> do
(issuesCommitChanged, filesChanged) <- getIssuesAndFilesCommitChanged hash
pure $
CommitInfo
@@ -237,7 +237,7 @@ getIssuesAndFilesWorkingTreeChanged paths = do
-- [tree](https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddeftreeatree)
-- of this commit.
getIssuesCommitAll :: Text -> IO [Issue]
-getIssuesCommitAll hash = do
+getIssuesCommitAll hash = cached (append hash (pack ".all")) $ \_ -> do
withSystemTempDirectory "history" $ \tmp -> do
let cwd = tmp </> unpack hash
Git.withWorkingTree cwd hash do