mirror of
https://github.com/ilyakooo0/optparse-applicative.git
synced 2024-08-16 06:00:24 +03:00
Add .hlint.yaml, fix some hlint warns, ignore others
Note: {-# ANN #-} start the GHCi interpreter (like TemplateHaskell!), so I removed that.
This commit is contained in:
parent
ad70813194
commit
ad2fa7f643
5
.hlint.yaml
Normal file
5
.hlint.yaml
Normal file
@ -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
|
@ -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" #-}
|
||||
|
@ -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
|
||||
|
@ -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:"
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user