Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable Move brackets to avoid $ hint for HLint. #486

Merged
merged 2 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .hlint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
- ignore: {name: "Avoid lambda"} # 1 hint
- ignore: {name: "Eta reduce"} # 1 hint
- ignore: {name: "Fuse foldr/map"} # 1 hint
- ignore: {name: "Move brackets to avoid $"} # 8 hints
- ignore: {name: "Use :"} # 2 hints
- ignore: {name: "Use <$"} # 1 hint
- ignore: {name: "Use <$>"} # 1 hint
Expand Down
8 changes: 4 additions & 4 deletions proto-lens-protoc/app/Data/ProtoLens/Compiler/Generate.hs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ generateModule modName fdesc imports publicImports definitions importedEnv servi
++ map importQualified (imports List.\\ publicImports)
++ map import' publicImports)
[])
$ (concatMap generateDecls $ Map.toList definitions)
$ concatMap generateDecls (Map.toList definitions)
++ map uncommented (concatMap (generateServiceDecls env) services)
++ map uncommented packedFileDescriptorProto
, CommentedModule pragmas
Expand Down Expand Up @@ -231,7 +231,7 @@ messageComment fieldModName n fields =
(moduleNameStrToString fieldModName)
(occNameStrToString $ nameFromSymbol $ lensSymbol l))
Outputable.<>
(Outputable.ppr $ var "Lens'" @@ t @@ lensFieldType l)
Outputable.ppr (var "Lens'" @@ t @@ lensFieldType l)
Outputable.<> Outputable.char '@'
t = var (unqual n)

Expand Down Expand Up @@ -422,15 +422,15 @@ generatePrisms env oneofInfo =
-- Sum type constructor
@@ var (unqual consName)
-- Case deconstruction
@@ (lambda [bvar "p__"] $
@@ lambda [bvar "p__"] (
case' (var "p__") $
[ match [conP (unqual consName) [bvar "p__val"]]
$ var "Prelude.Just" @@ var "p__val"
]
-- We want to generate the otherwise case
-- depending on the amount of sum type cases there are
++ otherwiseCase
)
)
generatePrism :: [RawMatch] -> OneofCase -> [HsDecl']
generatePrism otherwiseCase oneofCase =
let consName = caseConstructorName oneofCase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@ unsafeLiftIO' = var "Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO"
-- | Returns an expression of type @Parser a@ for the given field.
parseField :: FieldInfo -> HsExpr'
parseField f = var "Data.ProtoLens.Encoding.Bytes.<?>"
@@ (parseFieldType $ fieldInfoEncoding f)
@@ parseFieldType (fieldInfoEncoding f)
@@ string n
where
n = Text.unpack (fieldDescriptor f ^. #name)
Expand Down
2 changes: 1 addition & 1 deletion proto-lens-protoc/app/protoc-gen-haskell.hs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ makeResponse dflags prog request = let
]
preamble = defMessage
& #supportedFeatures .~
(foldl (.|.) zeroBits $ fmap (toEnum . fromEnum) features)
foldl (.|.) zeroBits (fmap (toEnum . fromEnum) features)
-- Do not process actual Protobuf Editions files yet.
& #minimumEdition .~ fromIntegral (fromEnum EDITION_PROTO2)
& #maximumEdition .~ fromIntegral (fromEnum EDITION_2023)
Expand Down
4 changes: 2 additions & 2 deletions proto-lens/src/Data/ProtoLens/Encoding/Bytes.hs
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ getVarIntH :: Handle -> ExceptT String IO Word64
getVarIntH h = do
buf <- liftIO malloc
let loopStart !n !s =
(liftIO $ hGetBuf h buf 1) >>=
liftIO (hGetBuf h buf 1) >>=
\case
1 -> (liftIO $ peek buf) >>=
1 -> liftIO (peek buf) >>=
getVarIntLoopFinish loopStart n s
_ -> throwE "Unexpected end of file"
res <- loopStart 0 1
Expand Down
2 changes: 1 addition & 1 deletion proto-lens/tests/parser_test.hs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ testFailure =
testIsolate :: [TestTree]
testIsolate =
[ testProperty "many" $ \bs bs' ->
runParser ((,) <$> (isolate (length bs) $ manyTillEnd getWord8) <*>
runParser ((,) <$> isolate (length bs) (manyTillEnd getWord8) <*>
manyTillEnd getWord8)
(B.pack (bs ++ bs'))
== Right (bs, bs')
Expand Down
Loading