diff --git a/.hlint.yaml b/.hlint.yaml index 9d23a3e5..881dc460 100644 --- a/.hlint.yaml +++ b/.hlint.yaml @@ -16,7 +16,6 @@ - ignore: {name: "Fuse foldr/map"} # 1 hint - ignore: {name: "Move brackets to avoid $"} # 8 hints - ignore: {name: "Redundant ^."} # 2 hints -- ignore: {name: "Redundant bracket"} # 13 hints - ignore: {name: "Unused LANGUAGE pragma"} # 11 hints - ignore: {name: "Use :"} # 2 hints - ignore: {name: "Use <$"} # 1 hint diff --git a/discrimination-ieee754/test/test.hs b/discrimination-ieee754/test/test.hs index 6b1edca2..eaa07a85 100644 --- a/discrimination-ieee754/test/test.hs +++ b/discrimination-ieee754/test/test.hs @@ -30,7 +30,7 @@ propNegLTPos :: Num a => Sort a -> (a, a) -> Bool propNegLTPos s (l, r) = sortCompare s (negate (abs l)) (abs r) == LT propNegZeroLTZero :: Fractional a => Sort a -> Bool -propNegZeroLTZero s = sortCompare s (-0.0) (0.0) == LT +propNegZeroLTZero s = sortCompare s (-0.0) 0.0 == LT inf :: Fractional a => a inf = 1.0 / 0 diff --git a/proto-lens-protoc/app/Data/ProtoLens/Compiler/Definitions.hs b/proto-lens-protoc/app/Data/ProtoLens/Compiler/Definitions.hs index 10b7430f..b5c0bd31 100644 --- a/proto-lens-protoc/app/Data/ProtoLens/Compiler/Definitions.hs +++ b/proto-lens-protoc/app/Data/ProtoLens/Compiler/Definitions.hs @@ -404,7 +404,7 @@ messageDefs features protoPrefix hsPrefix groups d , messageDescriptor = d , messageFields = map (PlainFieldInfo <$> - (fieldKind features' mapEntries) <*> (fieldInfo hsPrefix')) + fieldKind features' mapEntries <*> fieldInfo hsPrefix') $ Map.findWithDefault [] Nothing allFields , messageOneofFields = collectOneofFields hsPrefix' d allFields , messageUnknownFields = diff --git a/proto-lens-protoc/app/Data/ProtoLens/Compiler/Generate.hs b/proto-lens-protoc/app/Data/ProtoLens/Compiler/Generate.hs index 5b7bec70..dc4e1e56 100644 --- a/proto-lens-protoc/app/Data/ProtoLens/Compiler/Generate.hs +++ b/proto-lens-protoc/app/Data/ProtoLens/Compiler/Generate.hs @@ -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) @@ -412,7 +412,7 @@ generatePrisms env oneofInfo = -- The oneof sum type name @@ (var . unqual $ oneofTypeName oneofInfo) -- The field contained in the sum - @@ (hsFieldType env f) + @@ hsFieldType env f -- Generate function definition -- Prism' is constructed with Constructor for building value -- and Deconstructor and wrapping in Just for getting value @@ -880,7 +880,7 @@ hsFieldValueDefault env fd = case fd ^. #type' of -> var "Data.Text.pack" @@ string (T.unpack def) FieldDescriptorProto'TYPE_BYTES -> var "Data.ByteString.pack" - @@ list ((mkByte . fromEnum) <$> T.unpack def) + @@ list (mkByte . fromEnum <$> T.unpack def) where mkByte c | c > 0 && c < 255 = int $ fromIntegral c | otherwise = errorMessage "bytes" diff --git a/proto-lens-protoc/app/Data/ProtoLens/Compiler/Generate/Encoding.hs b/proto-lens-protoc/app/Data/ProtoLens/Compiler/Generate/Encoding.hs index 6c37b162..bf40c677 100644 --- a/proto-lens-protoc/app/Data/ProtoLens/Compiler/Generate/Encoding.hs +++ b/proto-lens-protoc/app/Data/ProtoLens/Compiler/Generate/Encoding.hs @@ -79,7 +79,7 @@ generatedParser env m = | Just g <- groupFieldNumber m = do' [ tag <-- getVarInt' , stmt $ case' tag $ - (match [int (groupEndTag g)] (finish m exprs)) + match [int (groupEndTag g)] (finish m exprs) : parseTagCases continue exprs m ] {- Regular message type: @@ -125,14 +125,14 @@ finish m s = do' $ [ stmt $ checkMissingFields s , stmt $ var "Prelude.return" @@ (over' unknownFields' (var "Prelude.reverse") - @@(foldr (@@) + @@ foldr (@@) (partialMessage s) (Map.intersectionWith (\finfo frozen -> var "Lens.Family2.set" @@ fieldOfVector finfo @@ var (unqual frozen)) - repeatedInfos frozenNames))) + repeatedInfos frozenNames)) ] where @@ -220,7 +220,7 @@ updateParseState :: HsExpr' -- ^ An expression of type @msg -> msg@ -> ParseState HsExpr' -> ParseState HsExpr' -updateParseState f s = s { partialMessage = f @@ (partialMessage s) } +updateParseState f s = s { partialMessage = f @@ partialMessage s } -- | Transform the loop arguments by marking a required field -- as having been set. @@ -264,7 +264,7 @@ checkMissingFields s = missing = "missing" allMissingFields = Map.foldrWithKey consIfMissing (list []) (requiredFieldsUnset s) consIfMissing (FieldId f) e rest = - (if' e (cons @@ string (Text.unpack f)) (var "Prelude.id")) @@ rest + if' e (cons @@ string (Text.unpack f)) (var "Prelude.id") @@ rest -- | A list case alternatives for the fields of a message. -- @@ -584,7 +584,7 @@ buildPackedField f x = let' [valBind p x] buildOneofField :: HsExpr' -> OneofInfo -> HsExpr' buildOneofField x info = case' (view' @@ fieldOfOneof info @@ x) $ - (match [conP_ "Prelude.Nothing"] mempty') + match [conP_ "Prelude.Nothing"] mempty' : [ match [conP "Prelude.Just" [conP (unqual $ caseConstructorName c) [v]]] $ buildTaggedField (caseField c) v diff --git a/proto-lens-tests/src/Data/ProtoLens/TestUtil.hs b/proto-lens-tests/src/Data/ProtoLens/TestUtil.hs index c417b2b5..c9a7395a 100644 --- a/proto-lens-tests/src/Data/ProtoLens/TestUtil.hs +++ b/proto-lens-tests/src/Data/ProtoLens/TestUtil.hs @@ -143,12 +143,14 @@ roundTripTest name = TypedTest $ testGroup name [ testProperty "shrink sanity" $ -- Disable automatic shrinking so the test behaves -- sensibly if there's a bug in shrinkMessage. - noShrinking ( #if MIN_VERSION_QuickCheck(2,10,0) + noShrinking $ -- Limit the number of tests since shrinking is slow for large messages. withMaxSuccess 20 + (shrinkSanityProperty :: MessageProperty a) +#else + noShrinking (shrinkSanityProperty :: MessageProperty a) #endif - (shrinkSanityProperty :: MessageProperty a)) , testProperty "wire" (wireRoundTripProperty :: MessageProperty a) , testProperty "text" (textRoundTripProperty :: MessageProperty a) ] diff --git a/proto-lens-tests/tests/text_format_test.hs b/proto-lens-tests/tests/text_format_test.hs index 96007a9d..7f5d07c5 100644 --- a/proto-lens-tests/tests/text_format_test.hs +++ b/proto-lens-tests/tests/text_format_test.hs @@ -96,7 +96,7 @@ main = testMain (Just $ def1 & b .~ "\a\b\f\n\r\t\v\\\'\"") (Data.Text.Lazy.pack "b: \"\a\b\f\n\r\t\v\\\\\\\'\\\"\"") , readFrom - ("Parse string with legal non-escaped \' quote character") + "Parse string with legal non-escaped \' quote character" (Just $ def1 & b .~ "'") (Data.Text.Lazy.pack "b: \"'\"") , testCase "Render string with escape sequences" $ diff --git a/proto-lens/tests/parser_test.hs b/proto-lens/tests/parser_test.hs index 20eae8e9..198a332e 100644 --- a/proto-lens/tests/parser_test.hs +++ b/proto-lens/tests/parser_test.hs @@ -74,7 +74,7 @@ testIsolate :: [TestTree] testIsolate = [ testProperty "many" $ \bs bs' -> runParser ((,) <$> (isolate (length bs) $ manyTillEnd getWord8) <*> - (manyTillEnd getWord8)) + manyTillEnd getWord8) (B.pack (bs ++ bs')) == Right (bs, bs') , testProperty "negative length" $ \n ws ->