diff --git a/.hlint.yaml b/.hlint.yaml new file mode 100644 index 0000000..0f1883b --- /dev/null +++ b/.hlint.yaml @@ -0,0 +1,5 @@ +# Ignore some builtin hints +- ignore: {name: "Use import/export shortcut" } +- ignore: {name: "Use tuple-section" } +- ignore: {name: "Use newtype instead of data" } # ArgumentFields +- ignore: {name: "Use fmap" } # we use liftM because Functor isn't superclass of Monad prior AMP diff --git a/Options/Applicative.hs b/Options/Applicative.hs index 0c6f38b..4eeb670 100644 --- a/Options/Applicative.hs +++ b/Options/Applicative.hs @@ -232,5 +232,3 @@ import Options.Applicative.Builder import Options.Applicative.Builder.Completer import Options.Applicative.Extra import Options.Applicative.Types - -{-# ANN module "HLint: ignore Use import/export shortcut" #-} diff --git a/Options/Applicative/Common.hs b/Options/Applicative/Common.hs index b9225b0..ef65acb 100644 --- a/Options/Applicative/Common.hs +++ b/Options/Applicative/Common.hs @@ -100,7 +100,7 @@ optMatches disambiguate opt (OptWord arg1 val) = case opt of guard $ is_short arg1 || isNothing val Just $ do args <- get - let val' = (\s -> '-' : s) <$> val + let val' = ('-' :) <$> val put $ maybeToList val' ++ args return x _ -> Nothing @@ -173,7 +173,7 @@ searchArg prefs arg = searchParser $ \opt -> do args <- get <* put [] fmap pure . lift $ enterContext arg subp *> runParserInfo subp args <* exitContext - (Just subp, Backtrack) -> fmap pure . lift . StateT $ \args -> do + (Just subp, Backtrack) -> fmap pure . lift . StateT $ \args -> enterContext arg subp *> runParser (infoPolicy subp) CmdStart (infoParser subp) args <* exitContext (Just subp, SubparserInline) -> lift $ do diff --git a/Options/Applicative/Help/Core.hs b/Options/Applicative/Help/Core.hs index 442e951..96e46c1 100644 --- a/Options/Applicative/Help/Core.hs +++ b/Options/Applicative/Help/Core.hs @@ -55,7 +55,7 @@ optDesc pprefs style info opt = | not show_opt = mempty | otherwise - = desc <> suffix + = desc `mappend` suffix modified = maybe id fmap (optDescMod opt) rendered in (modified, wrapping) @@ -164,8 +164,8 @@ footerHelp chunk = mempty { helpFooter = chunk } -- | Generate the help text for a program. parserHelp :: ParserPrefs -> Parser a -> ParserHelp -parserHelp pprefs p = bodyHelp . vsepChunks $ - ( with_title "Available options:" (fullDesc pprefs p) ) +parserHelp pprefs p = bodyHelp . vsepChunks + $ with_title "Available options:" (fullDesc pprefs p) : (group_title <$> cs) where def = "Available commands:" diff --git a/Options/Applicative/Help/Levenshtein.hs b/Options/Applicative/Help/Levenshtein.hs index 4282d94..a5dbfbb 100644 --- a/Options/Applicative/Help/Levenshtein.hs +++ b/Options/Applicative/Help/Levenshtein.hs @@ -43,10 +43,10 @@ editDistance a b = last $ -- will have an edit distance of 1. doDiag (ach:ach':as) (bch:bch':bs) nw n w | ach' == bch && ach == bch' - = nw : (doDiag (ach' : as) (bch' : bs) nw (tail n) (tail w)) + = nw : doDiag (ach' : as) (bch' : bs) nw (tail n) (tail w) -- Standard case doDiag (ach:as) (bch:bs) nw n w = - me : (doDiag as bs me (tail n) (tail w)) + me : doDiag as bs me (tail n) (tail w) where me = if ach == bch