From ca8439b6787eb238d7b07544dfc728488f3c71b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kier=C3=A1n=20Meinhardt?= Date: Tue, 22 Sep 2020 23:40:00 +0200 Subject: lint --- RenderTreeView.hs | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) (limited to 'RenderTreeView.hs') diff --git a/RenderTreeView.hs b/RenderTreeView.hs index 2962d60..cf8e6f3 100644 --- a/RenderTreeView.hs +++ b/RenderTreeView.hs @@ -70,7 +70,7 @@ renderTreeView now cur = renderPrefix :: Z.TreePos Z.Full TreeView -> Blessings String renderPrefix = - mconcat . reverse . map prefix . zip [(1 :: Int)..] . Z.path + mconcat . reverse . zipWith (curry prefix) [(1 :: Int)..] . Z.path where prefix (i, (_lhs, x, rhs)) = case x of TVSearch _ -> "" @@ -86,7 +86,7 @@ renderPrefix = then spacePrefix else pipePrefix _ -> - if null $ filter isTVMessage $ map rootLabel rhs + if not $ any (isTVMessage . rootLabel) rhs then spacePrefix else pipePrefix @@ -145,15 +145,14 @@ renderTreeView1 now hasFocus x = case x of in c $ Plain s TVSearchResult sr -> - let c = if hasFocus then focusSGR else - if isUnread - then unreadSearchSGR - else boringSGR - c_authors = - if hasFocus then focusSGR else - if isUnread - then altSGR - else boringSGR + let c + | hasFocus = focusSGR + | isUnread = unreadSearchSGR + | otherwise = boringSGR + c_authors + | hasFocus = focusSGR + | isUnread = altSGR + | otherwise = boringSGR isUnread = "unread" `elem` Notmuch.searchTags sr @@ -166,11 +165,10 @@ renderTreeView1 now hasFocus x = case x of c $ title <> " " <> date <> " " <> tags TVMessage m -> - let fromSGR = - if hasFocus then focusSGR else - if "unread" `elem` Notmuch.messageTags m - then unreadMessageSGR - else boringMessageSGR + let fromSGR + | hasFocus = focusSGR + | "unread" `elem` Notmuch.messageTags m = unreadMessageSGR + | otherwise = boringMessageSGR from = fromSGR $ renderFrom (M.lookup "from" $ Notmuch.messageHeaders m) date = dateSGR $ renderDate now x tags = tagsSGR $ renderTags (Notmuch.messageTags m) -- TODO filter common tags @@ -239,6 +237,6 @@ renderTag tag = case tag of dropAddress :: String -> String dropAddress xs = - case L.findIndices (=='<') xs of + case L.elemIndices '<' xs of [] -> xs is -> L.dropWhileEnd isSpace $ take (last is) xs -- cgit v1.2.3