proto-lens-protoc 0.7.1.1 → 0.8.0.0
raw patch · 5 files changed
+34/−43 lines, 5 filesdep ~basedep ~ghcdep ~textPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base, ghc, text
API changes (from Hackage documentation)
Files
- Changelog.md +6/−0
- app/Data/ProtoLens/Compiler/Definitions.hs +4/−4
- app/Data/ProtoLens/Compiler/Generate.hs +4/−0
- app/Data/ProtoLens/Compiler/Generate/Field.hs +14/−33
- proto-lens-protoc.cabal +6/−6
Changelog.md view
@@ -1,5 +1,11 @@ # Changelog for `proto-lens-protoc` ++## v0.8.0.0+- Relax upper bounds for ghc-9.6+- Incompatible change: change `forall` to `forall'` in generated code+ due to GHC warning of the upcoming change.+ ## v0.7.1.1 - Relax upper bounds for ghc-9.2
app/Data/ProtoLens/Compiler/Definitions.hs view
@@ -42,7 +42,6 @@ , overloadedFieldName ) where -import Control.Applicative (liftA2) import Data.Char (isUpper, toUpper) import Data.Int (Int32) import Data.List (mapAccumL)@@ -370,8 +369,8 @@ ++ "'_constructor" , messageDescriptor = d , messageFields =- map (liftA2 PlainFieldInfo- (fieldKind syntaxType mapEntries) (fieldInfo hsPrefix'))+ map (PlainFieldInfo <$>+ (fieldKind syntaxType mapEntries) <*> (fieldInfo hsPrefix')) $ Map.findWithDefault [] Nothing allFields , messageOneofFields = collectOneofFields hsPrefix' d allFields , messageUnknownFields =@@ -570,7 +569,7 @@ -- Haskell2010 keywords: -- https://www.haskell.org/onlinereport/haskell2010/haskellch2.html#x7-180002.4 -- We don't include keywords that are allowed to be variable names,- -- in particular: "as", "forall", and "hiding".+ -- in particular: "as" and "hiding". [ "case" , "class" , "data"@@ -578,6 +577,7 @@ , "deriving" , "do" , "else"+ , "forall" , "foreign" , "if" , "import"
app/Data/ProtoLens/Compiler/Generate.hs view
@@ -39,7 +39,11 @@ import GHC.Parser.Annotation (EpAnn(EpAnnNotUsed), SrcSpanAnn'(SrcSpanAnn)) #endif #if MIN_VERSION_ghc(9,0,0)+#if MIN_VERSION_ghc(9,6,0)+import Language.Haskell.Syntax.Module.Name (moduleNameString, mkModuleName)+#else import GHC.Unit.Module.Name (moduleNameString, mkModuleName)+#endif import qualified GHC.Utils.Outputable as Outputable import GHC.Types.SrcLoc (unLoc) import qualified GHC.Types.SrcLoc as SrcLoc
app/Data/ProtoLens/Compiler/Generate/Field.hs view
@@ -148,23 +148,6 @@ , wireType = wireType f } --- | Wrap a field encoding with Haskell functions that may fail during parsing.-partialField :: HsExpr' -> (HsExpr' -> HsExpr') -> FieldEncoding -> FieldEncoding-partialField buildF parseF f = FieldEncoding- { buildFieldType = var "Prelude.." @@ buildFieldType f @@ buildF- -- do- -- value <- ...- -- runEither $ {parseF} value- , parseFieldType = do'- [ value <-- parseFieldType f- , stmt $ runEither @@ parseF value- ]- , wireType = wireType f- }- where- value = bvar "value"- runEither = var "Data.ProtoLens.Encoding.Bytes.runEither"- -- | Convert a field of one integral type to another. integralField :: FieldEncoding -> FieldEncoding integralField = bijectField fromIntegral' fromIntegral'@@ -215,23 +198,21 @@ -- | A string, represented as Data.Text.Text. stringField :: FieldEncoding-stringField = partialField (var "Data.Text.Encoding.encodeUtf8") decodeUtf8P lengthy+stringField =+ FieldEncoding+ { wireType = 2+ , buildFieldType = buildString+ , parseFieldType = parseString+ } where- {- Translates to:- case decodeUtf8' bytes of- Left err -> Left (show err)- Right r -> r- Equivalently:- first show $ decodeUtf8' bytes- but avoids dragging in Data.Bifunctors.- -}- decodeUtf8P bytes =- case' (var "Data.Text.Encoding.decodeUtf8'" @@ bytes)- [ match ["Prelude.Left" `conP` [bvar "err"]]- $ var "Prelude.Left" @@ (var "Prelude.show" @@ var "err")- , match ["Prelude.Right" `conP` [bvar "r"]]- $ var "Prelude.Right" @@ var "r"- ]+ len = bvar "len"+ buildString = var "Prelude.." @@ buildFieldType lengthy+ @@ var "Data.Text.Encoding.encodeUtf8"+ parseString = do'+ [ len <-- getVarInt'+ , stmt $ var "Data.ProtoLens.Encoding.Bytes.getText"+ @@ (fromIntegral' @@ len)+ ] -- | A protobuf message type. message :: FieldEncoding
proto-lens-protoc.cabal view
@@ -1,11 +1,11 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.34.4.+-- This file has been generated from package.yaml by hpack version 0.36.0. -- -- see: https://github.com/sol/hpack name: proto-lens-protoc-version: 0.7.1.1+version: 0.8.0.0 synopsis: Protocol buffer compiler for the proto-lens library. description: Turn protocol buffer files (.proto) into Haskell files (.hs) which can be used with the proto-lens package. The library component of this package contains compiler code (namely Data.ProtoLens.Compiler.*) is not guaranteed to have stable APIs.'@@ -34,7 +34,7 @@ hs-source-dirs: src build-depends:- base >=4.9 && <4.17+ base >=4.10 && <4.19 , filepath >=1.4 && <1.6 default-language: Haskell2010 @@ -55,11 +55,11 @@ hs-source-dirs: app build-depends:- base >=4.9 && <4.17+ base >=4.10 && <4.19 , bytestring >=0.10 && <0.12 , containers >=0.5 && <0.7 , filepath >=1.4 && <1.6- , ghc >=8.2 && <9.3+ , ghc >=8.2 && <9.8 , ghc-paths ==0.1.* , ghc-source-gen ==0.4.* , lens-family >=1.2 && <2.2@@ -67,5 +67,5 @@ , proto-lens ==0.7.* , proto-lens-protoc , proto-lens-runtime ==0.7.*- , text >=1.2 && <2.1+ , text >=1.2 && <2.2 default-language: Haskell2010