From a88672dac3bdef836023a0fa66ef4ccc69d7f0ca Mon Sep 17 00:00:00 2001 From: Fabian Kirchner Date: Sat, 14 Oct 2023 14:34:22 +0200 Subject: refactor: simplify listIssues.. functions --- app/History.hs | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/app/History.hs b/app/History.hs index 396c309..c04d16a 100644 --- a/app/History.hs +++ b/app/History.hs @@ -95,12 +95,10 @@ cached commit func = do pure blob listIssuesCurrent :: [FilePath] -> IO [Issue] -listIssuesCurrent files = do +listIssuesCurrent paths = do worktree <- getCurrentDirectory - concat - <$> catch - (getIssuesPar worktree =<< (getFiles worktree files)) - (\(InvalidTreeGrepperResult e) -> die e) + files <- getFiles worktree paths + concat <$> (catch (getIssuesPar worktree files) (\(InvalidTreeGrepperResult e) -> die e)) listIssuesOf :: Text -> IO [Issue] listIssuesOf commit = do @@ -109,11 +107,8 @@ listIssuesOf commit = do let worktree = tmp unpack commit sh_ (fromString (printf "git worktree add --detach %s %s" (quote worktree) (quote (unpack commit)))) pure worktree - - concat - <$> catch - (getIssuesPar worktree =<< (getFilesChanged worktree)) - (\(InvalidTreeGrepperResult e) -> die e) + files <- getFilesChanged worktree + concat <$> catch (getIssuesPar worktree files) (\(InvalidTreeGrepperResult e) -> die e) forgetGetIssuesExceptions :: UnknownFileExtension -> IO [a] forgetGetIssuesExceptions _ = pure [] -- cgit v1.2.3