diff --git a/.hlint.yaml b/.hlint.yaml index f8622249f..5e6ed11ec 100644 --- a/.hlint.yaml +++ b/.hlint.yaml @@ -11,7 +11,6 @@ - ignore: {name: "Redundant $"} - ignore: {name: "Redundant bracket"} - ignore: {name: "Avoid reverse"} -- ignore: {name: "Eta reduce"} - ignore: {name: "Use sortOn"} - ignore: {name: "Use camelCase"} - ignore: {name: "Use list comprehension"} diff --git a/bin/_hledger-chart.hs b/bin/_hledger-chart.hs index 5dd0c5ce6..e4af1d8b3 100755 --- a/bin/_hledger-chart.hs +++ b/bin/_hledger-chart.hs @@ -183,7 +183,7 @@ sameSignNonZero is -- | Build a single pie chart item accountPieItem :: AccountName -> Double -> PieItem -accountPieItem accname balance = PieItem (T.unpack accname) offset balance where offset = 0 +accountPieItem accname = PieItem (T.unpack accname) offset where offset = 0 -- | Generate an infinite color list suitable for charts. mkColours :: Double -> [AlphaColour Double] diff --git a/hledger-lib/Hledger/Data/Journal.hs b/hledger-lib/Hledger/Data/Journal.hs index 414f71042..92c5c67c5 100644 --- a/hledger-lib/Hledger/Data/Journal.hs +++ b/hledger-lib/Hledger/Data/Journal.hs @@ -429,8 +429,7 @@ journalAssetAccountQuery j = -- or otherwise for accounts with names matched by the case-insensitive -- regular expression @^assets?(:|$)@. journalAssetNonCashAccountQuery :: Journal -> Query -journalAssetNonCashAccountQuery j = - journalAccountTypeQuery [Asset] (toRegexCI' "^assets?(:|$)") j +journalAssetNonCashAccountQuery = journalAccountTypeQuery [Asset] (toRegexCI' "^assets?(:|$)") -- | A query for Cash (liquid asset) accounts in this journal, ie accounts -- declared as Cash by account directives, or otherwise Asset accounts whose @@ -1112,7 +1111,7 @@ commodityStylesFromAmounts = -- | Given a list of amount styles (assumed to be from parsed amounts -- in a single commodity), in parse order, choose a canonical style. canonicalStyleFrom :: [AmountStyle] -> AmountStyle -canonicalStyleFrom ss = foldl' canonicalStyle amountstyle ss +canonicalStyleFrom = foldl' canonicalStyle amountstyle -- TODO: should probably detect and report inconsistencies here. -- Though, we don't have the info for a good error message, so maybe elsewhere. diff --git a/hledger-lib/Hledger/Read/Common.hs b/hledger-lib/Hledger/Read/Common.hs index b0238d652..2ae328639 100644 --- a/hledger-lib/Hledger/Read/Common.hs +++ b/hledger-lib/Hledger/Read/Common.hs @@ -281,14 +281,14 @@ forecastPeriodFromRawOpts d rawopts = do -- | Run a text parser in the identity monad. See also: parseWithState. runTextParser, rtp :: TextParser Identity a -> Text -> Either (ParseErrorBundle Text CustomErr) a -runTextParser p t = runParser p "" t +runTextParser p = runParser p "" rtp = runTextParser -- | Run a journal parser in some monad. See also: parseWithState. runJournalParser, rjp :: Monad m => JournalParser m a -> Text -> m (Either (ParseErrorBundle Text CustomErr) a) -runJournalParser p t = runParserT (evalStateT p nulljournal) "" t +runJournalParser p = runParserT (evalStateT p nulljournal) "" rjp = runJournalParser -- | Run an erroring journal parser in some monad. See also: parseWithState. diff --git a/hledger-lib/Hledger/Read/CsvReader.hs b/hledger-lib/Hledger/Read/CsvReader.hs index af45e6de4..d4fe051e3 100644 --- a/hledger-lib/Hledger/Read/CsvReader.hs +++ b/hledger-lib/Hledger/Read/CsvReader.hs @@ -170,7 +170,7 @@ addAssignment :: (HledgerFieldName, FieldTemplate) -> CsvRulesParsed -> CsvRules addAssignment a r = r{rassignments=a:rassignments r} setIndexesAndAssignmentsFromList :: [CsvFieldName] -> CsvRulesParsed -> CsvRulesParsed -setIndexesAndAssignmentsFromList fs r = addAssignmentsFromList fs . setCsvFieldIndexesFromList fs $ r +setIndexesAndAssignmentsFromList fs = addAssignmentsFromList fs . setCsvFieldIndexesFromList fs setCsvFieldIndexesFromList :: [CsvFieldName] -> CsvRulesParsed -> CsvRulesParsed setCsvFieldIndexesFromList fs r = r{rcsvfieldindexes=zip fs [1..]} @@ -223,8 +223,7 @@ parseAndValidateCsvRules rulesfile s = -- | Parse this text as CSV conversion rules. The file path is for error messages. parseCsvRules :: FilePath -> T.Text -> Either (ParseErrorBundle T.Text CustomErr) CsvRules -- parseCsvRules rulesfile s = runParser csvrulesfile nullrules{baseAccount=takeBaseName rulesfile} rulesfile s -parseCsvRules rulesfile s = - runParser (evalStateT rulesp defrules) rulesfile s +parseCsvRules = runParser (evalStateT rulesp defrules) -- | Return the validated rules, or an error. validateRules :: CsvRules -> Either String CsvRules diff --git a/hledger-lib/Hledger/Reports/ReportOptions.hs b/hledger-lib/Hledger/Reports/ReportOptions.hs index c5a4b0d2d..3ef2c3a0a 100644 --- a/hledger-lib/Hledger/Reports/ReportOptions.hs +++ b/hledger-lib/Hledger/Reports/ReportOptions.hs @@ -710,7 +710,7 @@ instance (e ~ a) => Reportable (Either a) e where -- | Apply a function over a lens, but report on failure. overWithReport :: ((a -> Either e b) -> s -> Either e t) -> (a -> b) -> s -> Either e t -overWithReport l f s = l (pure . f) s +overWithReport l f = l (pure . f) -- | Set a field using a lens, but report on failure. setWithReport :: ((a -> Either e b) -> s -> Either e t) -> b -> s -> Either e t diff --git a/hledger-lib/Hledger/Utils/Debug.hs b/hledger-lib/Hledger/Utils/Debug.hs index 47f2b3cf1..89099bae3 100644 --- a/hledger-lib/Hledger/Utils/Debug.hs +++ b/hledger-lib/Hledger/Utils/Debug.hs @@ -439,5 +439,5 @@ traceParseAt level msg = when (level <= debugLevel) $ traceParse msg -- | Convenience alias for traceParseAt dbgparse :: Int -> String -> TextParser m () -dbgparse level msg = traceParseAt level msg +dbgparse = traceParseAt diff --git a/hledger-lib/Hledger/Utils/Parse.hs b/hledger-lib/Hledger/Utils/Parse.hs index 00d59450f..9c2c1e3fd 100644 --- a/hledger-lib/Hledger/Utils/Parse.hs +++ b/hledger-lib/Hledger/Utils/Parse.hs @@ -95,7 +95,7 @@ parseWithState -> StateT st (ParsecT CustomErr Text m) a -> Text -> m (Either (ParseErrorBundle Text CustomErr) a) -parseWithState ctx p s = runParserT (evalStateT p ctx) "" s +parseWithState ctx p = runParserT (evalStateT p ctx) "" parseWithState' :: (Stream s) @@ -103,7 +103,7 @@ parseWithState' -> StateT st (ParsecT e s Identity) a -> s -> (Either (ParseErrorBundle s e) a) -parseWithState' ctx p s = runParser (evalStateT p ctx) "" s +parseWithState' ctx p = runParser (evalStateT p ctx) "" fromparse :: (Show t, Show (Token t), Show e) => Either (ParseErrorBundle t e) a -> a diff --git a/hledger-lib/Hledger/Utils/Test.hs b/hledger-lib/Hledger/Utils/Test.hs index 4c4c65225..dcc00c574 100644 --- a/hledger-lib/Hledger/Utils/Test.hs +++ b/hledger-lib/Hledger/Utils/Test.hs @@ -80,7 +80,7 @@ assertParse parser input = do -- | Assert a parser produces an expected value. assertParseEq :: (HasCallStack, Eq a, Show a, Default st) => StateT st (ParsecT CustomErr T.Text IO) a -> T.Text -> a -> Assertion -assertParseEq parser input expected = assertParseEqOn parser input id expected +assertParseEq parser input = assertParseEqOn parser input id -- | Like assertParseEq, but transform the parse result with the given function -- before comparing it. @@ -146,7 +146,7 @@ assertParseEqE -> T.Text -> a -> Assertion -assertParseEqE parser input expected = assertParseEqOnE parser input id expected +assertParseEqE parser input = assertParseEqOnE parser input id assertParseEqOnE :: (HasCallStack, Eq b, Show b, Default st) diff --git a/hledger-lib/Text/Megaparsec/Custom.hs b/hledger-lib/Text/Megaparsec/Custom.hs index f54272c49..c1bfb8e17 100644 --- a/hledger-lib/Text/Megaparsec/Custom.hs +++ b/hledger-lib/Text/Megaparsec/Custom.hs @@ -103,7 +103,7 @@ instance ShowErrorComponent CustomErr where -- point). parseErrorAt :: Int -> String -> CustomErr -parseErrorAt offset msg = ErrorFailAt offset (offset+1) msg +parseErrorAt offset = ErrorFailAt offset (offset+1) -- | Fail at a specific source interval, given by the raw offsets of its -- endpoints from the start of the input stream (the numbers of tokens diff --git a/hledger/Hledger/Cli/CliOptions.hs b/hledger/Hledger/Cli/CliOptions.hs index 5c17a7cb7..1235c33ee 100644 --- a/hledger/Hledger/Cli/CliOptions.hs +++ b/hledger/Hledger/Cli/CliOptions.hs @@ -242,7 +242,7 @@ commodityStyleFlag = flagReq ("Override the commodity style in the output for the specified commodity. For example 'EUR1.000,00'.") argsFlag :: FlagHelp -> Arg RawOpts -argsFlag desc = flagArg (\s opts -> Right $ setopt "args" s opts) desc +argsFlag = flagArg (\s opts -> Right $ setopt "args" s opts) generalflagstitle :: String generalflagstitle = "\nGeneral flags" diff --git a/tools/generatejournal.hs b/tools/generatejournal.hs index 609443726..93aa92993 100755 --- a/tools/generatejournal.hs +++ b/tools/generatejournal.hs @@ -49,7 +49,7 @@ showtxn txnno date acct1 acct2 comm pricecomm = rate = 0.70 + 0.01 * fromIntegral (txnno `rem` 60) :: Decimal showmarketprice :: Day -> Double -> String -showmarketprice date rate = printf "P %s A %.2f B\n" (show date) rate +showmarketprice date = printf "P %s A %.2f B\n" (show date) uniqueAccountNames :: [String] -> Int -> [String] uniqueAccountNames opts depth =