packages feed

proto-lens-protobuf-types 0.6.0.0 → 0.7.0.0

raw patch · 3 files changed

+46/−7 lines, 3 filesdep ~basedep ~proto-lensdep ~proto-lens-runtimenew-uploader

Dependency ranges changed: base, proto-lens, proto-lens-runtime

Files

Changelog.md view
@@ -1,5 +1,10 @@ # Changelog for `proto-lens-protobuf-types` +## v0.7.0.0+- Add the module `Data.ProtoLens.Descriptor`.  It exposes `messageDescriptor`,+  which makes it easier to get the descriptor proto for a given message type.+- Bump upper bound to allow base-4.14.+ ## v0.6.0.0 - Bump lower bounds to base-4.10 (ghc-8.2). - Support dependencies on base-4.13 (ghc-8.8) and lens-family-2.0.
proto-lens-protobuf-types.cabal view
@@ -1,13 +1,13 @@ cabal-version: 2.0 --- This file has been generated from package.yaml by hpack version 0.31.2.+-- This file has been generated from package.yaml by hpack version 0.33.0. -- -- see: https://github.com/sol/hpack ----- hash: 6fff397cb28cd075e027babec460623039628f01e3ce35bf4dd3735db4c8f3c4+-- hash: a8f93d2a40c305e2b4e5e09a48bbae810f2adaec8fbc8e7c3a731c2bb525627b  name:           proto-lens-protobuf-types-version:        0.6.0.0+version:        0.7.0.0 synopsis:       Basic protocol buffer message types. description:    This package provides bindings standard protocol message types, for use with the proto-lens library. category:       Data@@ -37,12 +37,13 @@ custom-setup   setup-depends:       Cabal-    , base >=4.10 && <4.14+    , base >=4.10 && <4.15     , proto-lens-setup ==0.4.*  library   exposed-modules:       Data.ProtoLens.Any+      Data.ProtoLens.Descriptor       Proto.Google.Protobuf.Any       Proto.Google.Protobuf.Any_Fields       Proto.Google.Protobuf.Compiler.Plugin@@ -77,9 +78,9 @@   build-tool-depends:       proto-lens-protoc:proto-lens-protoc   build-depends:-      base >=4.10 && <4.14+      base >=4.10 && <4.15     , lens-family >=1.2 && <2.1-    , proto-lens ==0.6.*-    , proto-lens-runtime ==0.6.*+    , proto-lens ==0.7.*+    , proto-lens-runtime ==0.7.*     , text ==1.2.*   default-language: Haskell2010
+ src/Data/ProtoLens/Descriptor.hs view
@@ -0,0 +1,33 @@+{-# LANGUAGE AllowAmbiguousTypes #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TypeApplications #-}+-- | Functions for interacting with message descriptors.+module Data.ProtoLens.Descriptor+    ( DescriptorProto+    , messageDescriptor+    , fileDescriptor+    ) where++import Data.ProtoLens+import Data.Proxy (Proxy(..))+import Proto.Google.Protobuf.Descriptor++-- | The protocol buffer message descriptor for a given type.+--+-- This function should be used with @TypeApplications@, e.g.:+--+-- > messageDescriptor @SomeProtoType+messageDescriptor :: forall a . Message a => DescriptorProto+-- Note: technically decodeMessageOrDie can fail.  However, it's+-- unlikely in practice since we encode the message ourselves+-- in proto-lens-protoc; and furthermore proto decoding is robust+-- to unknown/missing fields.+messageDescriptor = decodeMessageOrDie $ packedMessageDescriptor (Proxy @a)++-- | The protocol buffer file descriptor containing a given type.+--+-- This function should be used with @TypeApplications@, e.g.:+--+-- > fileDescriptor @SomeProtoType+fileDescriptor :: forall a . Message a => FileDescriptorProto+fileDescriptor = decodeMessageOrDie $ packedFileDescriptor (Proxy @a)