cln: hlint: Remove eta reduce warnings.
This commit is contained in:
parent
32dad455fd
commit
d248aec313
@ -11,7 +11,6 @@
|
|||||||
- ignore: {name: "Redundant $"}
|
- ignore: {name: "Redundant $"}
|
||||||
- ignore: {name: "Redundant bracket"}
|
- ignore: {name: "Redundant bracket"}
|
||||||
- ignore: {name: "Avoid reverse"}
|
- ignore: {name: "Avoid reverse"}
|
||||||
- ignore: {name: "Eta reduce"}
|
|
||||||
- ignore: {name: "Use sortOn"}
|
- ignore: {name: "Use sortOn"}
|
||||||
- ignore: {name: "Use camelCase"}
|
- ignore: {name: "Use camelCase"}
|
||||||
- ignore: {name: "Use list comprehension"}
|
- ignore: {name: "Use list comprehension"}
|
||||||
|
|||||||
@ -183,7 +183,7 @@ sameSignNonZero is
|
|||||||
|
|
||||||
-- | Build a single pie chart item
|
-- | Build a single pie chart item
|
||||||
accountPieItem :: AccountName -> Double -> PieItem
|
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.
|
-- | Generate an infinite color list suitable for charts.
|
||||||
mkColours :: Double -> [AlphaColour Double]
|
mkColours :: Double -> [AlphaColour Double]
|
||||||
|
|||||||
@ -429,8 +429,7 @@ journalAssetAccountQuery j =
|
|||||||
-- or otherwise for accounts with names matched by the case-insensitive
|
-- or otherwise for accounts with names matched by the case-insensitive
|
||||||
-- regular expression @^assets?(:|$)@.
|
-- regular expression @^assets?(:|$)@.
|
||||||
journalAssetNonCashAccountQuery :: Journal -> Query
|
journalAssetNonCashAccountQuery :: Journal -> Query
|
||||||
journalAssetNonCashAccountQuery j =
|
journalAssetNonCashAccountQuery = journalAccountTypeQuery [Asset] (toRegexCI' "^assets?(:|$)")
|
||||||
journalAccountTypeQuery [Asset] (toRegexCI' "^assets?(:|$)") j
|
|
||||||
|
|
||||||
-- | A query for Cash (liquid asset) accounts in this journal, ie accounts
|
-- | A query for Cash (liquid asset) accounts in this journal, ie accounts
|
||||||
-- declared as Cash by account directives, or otherwise Asset accounts whose
|
-- 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
|
-- | Given a list of amount styles (assumed to be from parsed amounts
|
||||||
-- in a single commodity), in parse order, choose a canonical style.
|
-- in a single commodity), in parse order, choose a canonical style.
|
||||||
canonicalStyleFrom :: [AmountStyle] -> AmountStyle
|
canonicalStyleFrom :: [AmountStyle] -> AmountStyle
|
||||||
canonicalStyleFrom ss = foldl' canonicalStyle amountstyle ss
|
canonicalStyleFrom = foldl' canonicalStyle amountstyle
|
||||||
|
|
||||||
-- TODO: should probably detect and report inconsistencies here.
|
-- TODO: should probably detect and report inconsistencies here.
|
||||||
-- Though, we don't have the info for a good error message, so maybe elsewhere.
|
-- Though, we don't have the info for a good error message, so maybe elsewhere.
|
||||||
|
|||||||
@ -281,14 +281,14 @@ forecastPeriodFromRawOpts d rawopts = do
|
|||||||
-- | Run a text parser in the identity monad. See also: parseWithState.
|
-- | Run a text parser in the identity monad. See also: parseWithState.
|
||||||
runTextParser, rtp
|
runTextParser, rtp
|
||||||
:: TextParser Identity a -> Text -> Either (ParseErrorBundle Text CustomErr) a
|
:: TextParser Identity a -> Text -> Either (ParseErrorBundle Text CustomErr) a
|
||||||
runTextParser p t = runParser p "" t
|
runTextParser p = runParser p ""
|
||||||
rtp = runTextParser
|
rtp = runTextParser
|
||||||
|
|
||||||
-- | Run a journal parser in some monad. See also: parseWithState.
|
-- | Run a journal parser in some monad. See also: parseWithState.
|
||||||
runJournalParser, rjp
|
runJournalParser, rjp
|
||||||
:: Monad m
|
:: Monad m
|
||||||
=> JournalParser m a -> Text -> m (Either (ParseErrorBundle Text CustomErr) a)
|
=> 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
|
rjp = runJournalParser
|
||||||
|
|
||||||
-- | Run an erroring journal parser in some monad. See also: parseWithState.
|
-- | Run an erroring journal parser in some monad. See also: parseWithState.
|
||||||
|
|||||||
@ -170,7 +170,7 @@ addAssignment :: (HledgerFieldName, FieldTemplate) -> CsvRulesParsed -> CsvRules
|
|||||||
addAssignment a r = r{rassignments=a:rassignments r}
|
addAssignment a r = r{rassignments=a:rassignments r}
|
||||||
|
|
||||||
setIndexesAndAssignmentsFromList :: [CsvFieldName] -> CsvRulesParsed -> CsvRulesParsed
|
setIndexesAndAssignmentsFromList :: [CsvFieldName] -> CsvRulesParsed -> CsvRulesParsed
|
||||||
setIndexesAndAssignmentsFromList fs r = addAssignmentsFromList fs . setCsvFieldIndexesFromList fs $ r
|
setIndexesAndAssignmentsFromList fs = addAssignmentsFromList fs . setCsvFieldIndexesFromList fs
|
||||||
|
|
||||||
setCsvFieldIndexesFromList :: [CsvFieldName] -> CsvRulesParsed -> CsvRulesParsed
|
setCsvFieldIndexesFromList :: [CsvFieldName] -> CsvRulesParsed -> CsvRulesParsed
|
||||||
setCsvFieldIndexesFromList fs r = r{rcsvfieldindexes=zip fs [1..]}
|
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.
|
-- | 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 :: FilePath -> T.Text -> Either (ParseErrorBundle T.Text CustomErr) CsvRules
|
||||||
-- parseCsvRules rulesfile s = runParser csvrulesfile nullrules{baseAccount=takeBaseName rulesfile} rulesfile s
|
-- parseCsvRules rulesfile s = runParser csvrulesfile nullrules{baseAccount=takeBaseName rulesfile} rulesfile s
|
||||||
parseCsvRules rulesfile s =
|
parseCsvRules = runParser (evalStateT rulesp defrules)
|
||||||
runParser (evalStateT rulesp defrules) rulesfile s
|
|
||||||
|
|
||||||
-- | Return the validated rules, or an error.
|
-- | Return the validated rules, or an error.
|
||||||
validateRules :: CsvRules -> Either String CsvRules
|
validateRules :: CsvRules -> Either String CsvRules
|
||||||
|
|||||||
@ -710,7 +710,7 @@ instance (e ~ a) => Reportable (Either a) e where
|
|||||||
|
|
||||||
-- | Apply a function over a lens, but report on failure.
|
-- | 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 :: ((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.
|
-- | Set a field using a lens, but report on failure.
|
||||||
setWithReport :: ((a -> Either e b) -> s -> Either e t) -> b -> s -> Either e t
|
setWithReport :: ((a -> Either e b) -> s -> Either e t) -> b -> s -> Either e t
|
||||||
|
|||||||
@ -439,5 +439,5 @@ traceParseAt level msg = when (level <= debugLevel) $ traceParse msg
|
|||||||
|
|
||||||
-- | Convenience alias for traceParseAt
|
-- | Convenience alias for traceParseAt
|
||||||
dbgparse :: Int -> String -> TextParser m ()
|
dbgparse :: Int -> String -> TextParser m ()
|
||||||
dbgparse level msg = traceParseAt level msg
|
dbgparse = traceParseAt
|
||||||
|
|
||||||
|
|||||||
@ -95,7 +95,7 @@ parseWithState
|
|||||||
-> StateT st (ParsecT CustomErr Text m) a
|
-> StateT st (ParsecT CustomErr Text m) a
|
||||||
-> Text
|
-> Text
|
||||||
-> m (Either (ParseErrorBundle Text CustomErr) a)
|
-> m (Either (ParseErrorBundle Text CustomErr) a)
|
||||||
parseWithState ctx p s = runParserT (evalStateT p ctx) "" s
|
parseWithState ctx p = runParserT (evalStateT p ctx) ""
|
||||||
|
|
||||||
parseWithState'
|
parseWithState'
|
||||||
:: (Stream s)
|
:: (Stream s)
|
||||||
@ -103,7 +103,7 @@ parseWithState'
|
|||||||
-> StateT st (ParsecT e s Identity) a
|
-> StateT st (ParsecT e s Identity) a
|
||||||
-> s
|
-> s
|
||||||
-> (Either (ParseErrorBundle s e) a)
|
-> (Either (ParseErrorBundle s e) a)
|
||||||
parseWithState' ctx p s = runParser (evalStateT p ctx) "" s
|
parseWithState' ctx p = runParser (evalStateT p ctx) ""
|
||||||
|
|
||||||
fromparse
|
fromparse
|
||||||
:: (Show t, Show (Token t), Show e) => Either (ParseErrorBundle t e) a -> a
|
:: (Show t, Show (Token t), Show e) => Either (ParseErrorBundle t e) a -> a
|
||||||
|
|||||||
@ -80,7 +80,7 @@ assertParse parser input = do
|
|||||||
-- | Assert a parser produces an expected value.
|
-- | Assert a parser produces an expected value.
|
||||||
assertParseEq :: (HasCallStack, Eq a, Show a, Default st) =>
|
assertParseEq :: (HasCallStack, Eq a, Show a, Default st) =>
|
||||||
StateT st (ParsecT CustomErr T.Text IO) a -> T.Text -> a -> Assertion
|
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
|
-- | Like assertParseEq, but transform the parse result with the given function
|
||||||
-- before comparing it.
|
-- before comparing it.
|
||||||
@ -146,7 +146,7 @@ assertParseEqE
|
|||||||
-> T.Text
|
-> T.Text
|
||||||
-> a
|
-> a
|
||||||
-> Assertion
|
-> Assertion
|
||||||
assertParseEqE parser input expected = assertParseEqOnE parser input id expected
|
assertParseEqE parser input = assertParseEqOnE parser input id
|
||||||
|
|
||||||
assertParseEqOnE
|
assertParseEqOnE
|
||||||
:: (HasCallStack, Eq b, Show b, Default st)
|
:: (HasCallStack, Eq b, Show b, Default st)
|
||||||
|
|||||||
@ -103,7 +103,7 @@ instance ShowErrorComponent CustomErr where
|
|||||||
-- point).
|
-- point).
|
||||||
|
|
||||||
parseErrorAt :: Int -> String -> CustomErr
|
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
|
-- | 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
|
-- endpoints from the start of the input stream (the numbers of tokens
|
||||||
|
|||||||
@ -242,7 +242,7 @@ commodityStyleFlag = flagReq
|
|||||||
("Override the commodity style in the output for the specified commodity. For example 'EUR1.000,00'.")
|
("Override the commodity style in the output for the specified commodity. For example 'EUR1.000,00'.")
|
||||||
|
|
||||||
argsFlag :: FlagHelp -> Arg RawOpts
|
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 :: String
|
||||||
generalflagstitle = "\nGeneral flags"
|
generalflagstitle = "\nGeneral flags"
|
||||||
|
|||||||
@ -49,7 +49,7 @@ showtxn txnno date acct1 acct2 comm pricecomm =
|
|||||||
rate = 0.70 + 0.01 * fromIntegral (txnno `rem` 60) :: Decimal
|
rate = 0.70 + 0.01 * fromIntegral (txnno `rem` 60) :: Decimal
|
||||||
|
|
||||||
showmarketprice :: Day -> Double -> String
|
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 :: [String] -> Int -> [String]
|
||||||
uniqueAccountNames opts depth =
|
uniqueAccountNames opts depth =
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user