From 435fbf001e89e110b5009646908aaf3ae1d2d842 Mon Sep 17 00:00:00 2001 From: Stephen Morgan Date: Mon, 16 Aug 2021 15:44:42 +1000 Subject: [PATCH] cln: hlint: Remove <|> and bimap warnings. --- .hlint.yaml | 2 -- hledger-lib/Hledger/Read/JournalReader.hs | 5 +---- hledger-lib/Text/Tabular/AsciiWide.hs | 3 ++- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/.hlint.yaml b/.hlint.yaml index 175969347..26e8c39a1 100644 --- a/.hlint.yaml +++ b/.hlint.yaml @@ -47,7 +47,6 @@ - ignore: {name: "Use zipWith"} - ignore: {name: "Replace case with maybe"} - ignore: {name: "Avoid lambda using `infix`"} -- ignore: {name: "Use <|>"} - ignore: {name: "Use zip"} - ignore: {name: "Functor law"} - ignore: {name: "Missing NOINLINE pragma"} @@ -56,7 +55,6 @@ - ignore: {name: "Redundant flip"} - ignore: {name: "Use replicate"} - ignore: {name: "Use void"} -- ignore: {name: "Use bimap"} - ignore: {name: "Use elemIndex"} - ignore: {name: "Use =="} - ignore: {name: "Use lambda-case"} diff --git a/hledger-lib/Hledger/Read/JournalReader.hs b/hledger-lib/Hledger/Read/JournalReader.hs index ed80fb298..7fe2d8421 100644 --- a/hledger-lib/Hledger/Read/JournalReader.hs +++ b/hledger-lib/Hledger/Read/JournalReader.hs @@ -341,10 +341,7 @@ accountdirectivep = do -- an account type may have been set by account type code or a tag; -- the latter takes precedence let - mtypecode' :: Maybe Text = maybe - (T.singleton <$> mtypecode) - Just - $ lookup accountTypeTagName tags + mtypecode' :: Maybe Text = lookup accountTypeTagName tags <|> (T.singleton <$> mtypecode) metype = parseAccountTypeCode <$> mtypecode' -- update the journal diff --git a/hledger-lib/Text/Tabular/AsciiWide.hs b/hledger-lib/Text/Tabular/AsciiWide.hs index 305dc5675..37bcee54f 100644 --- a/hledger-lib/Text/Tabular/AsciiWide.hs +++ b/hledger-lib/Text/Tabular/AsciiWide.hs @@ -24,6 +24,7 @@ module Text.Tabular.AsciiWide , concatTables ) where +import Data.Bifunctor (bimap) import Data.Maybe (fromMaybe) import Data.Default (Default(..)) import Data.List (intersperse, transpose) @@ -94,7 +95,7 @@ renderTableB :: TableOpts -- ^ Options controlling Table rendering -> (a -> Cell) -- ^ Function determining the string and width of a cell -> Table rh ch a -> Builder -renderTableB topts fr fc f = renderTableByRowsB topts (fmap fc) (\(rh, as) -> (fr rh, fmap f as)) +renderTableB topts fr fc f = renderTableByRowsB topts (fmap fc) $ bimap fr (fmap f) -- | A version of renderTable that operates on rows (including the 'row' of -- column headers) and returns the underlying Builder.