Bump the github-actions group across 1 directory with 3 updates (#532)
Bumps the github-actions group with 3 updates in the / directory: actions/checkout, haskell-actions/setup and actions/cache.
Updates
actions/checkoutfrom 6 to 7Updates
haskell-actions/setupfrom 2.8.2 to 2.11.0Updates
actions/cachefrom 4.3.0 to 6.1.0
updated-dependencies:
- dependency-name: actions/checkout dependency-version: ‘7’ dependency-type: direct:production update-type: version-update:semver-major dependency-group: github-actions
- dependency-name: haskell-actions/setup dependency-version: 2.11.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: github-actions
- dependency-name: actions/cache dependency-version: 6.1.0 dependency-type: direct:production update-type: version-update:semver-major dependency-group: github-actions …
Signed-off-by: dependabot[bot] support@github.com Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
版权所有:中国计算机学会技术支持:开源发展技术委员会
京ICP备13000930号-9
京公网安备 11010802047560号
proto-lens
The proto-lens library provides an API for protocol buffers using modern Haskell language and library patterns. Specifically, it provides:
This is not an official Google product.
Tutorial
You can find tutorial documentation in the proto-lens-tutorial subdir.
There is also a reference document showing the protobuf scalar type -> haskell type mappings used by the generated lenses.
Instructions
Setup
First, install the “protoc” binary somewhere in your PATH. You can get it by following these instructions.
This project requires at least
protocversion 28.0.Building from HEAD
To build and test this repository from HEAD, run:
Note: building this repository requires
stack-2.3.1or newer.Using in a Cabal or Stack package
proto-lensis available on Hackage and Stackage. Cabal and Stack projects can use it to auto-generate Haskell source files from the original protocol buffer specifications (.protofiles).Note: if using Stack, these instructions require
v1.4.0or newer.First, edit the
.cabalfile of your project to:build-type: Custom, and add acustom-setupclause that depends onproto-lens-setup.build-tool-depends: proto-lens-protoc:proto-lens-protoc.extra-source-files. Note that the field belongs at the top level of the.cabalfile, rather than once per library/executable/etc.Proto.Foo.Bar) inexposed-modulesorother-modulesof the rule(s) that use them (e.g. the library or executables).proto-lens-runtimeto the build-depends of those rules.custom-setupclause to your .cabal file.For example, in
foo-bar-proto.cabal:(Note: if you do not have
proto-lens-{runtime/setup}, you are probably using a version earlier than0.4and should replace those packages withproto-lens-protoc.)Next, write a
Setup.hsfile that usesData.ProtoLens.Setupand specifies the directory containing the.protofiles. For example:Then, when you run
cabal buildorstack build, Cabal will generate a Haskell file from each .proto file, and use it as part of building the library/executable/etc.See the
proto-lens-testspackage for some more detailed examples.Manually running the protocol compiler
Suppose you have a file
foo.proto. Then to generate bindings, run:This will generate a file
Proto/Foo.hswhich contains Haskell definitions corresponding to the messages and fields in the protocol buffer file.Use
--haskell_outto control the location of the output file.Use
--proto_pathto specify the location of input.protofiles. For example, suppose we have the filessrc/project/{foo,bar}.proto, andbar.protohas the lineThen running:
will generate the haskell files
Proto/Project/{Foo,Bar}.hs.Current differences from the standard
Protobuf Editions
features.utf8_validation = NONEdoes not disable UTF-8 validation.If more than one field sharing the same message type are in a single message type, and if one of the fields has
features.message_encoding = DELIMITED, then all of these fields will useDELIMITEDencoding.Troubleshooting
Rebuilding
Due to stack issue #1891, if you only change the .proto files then stack won’t rebuild the package (that is, it won’t regenerate the
Proto.*modules).Loading into
ghciwith Stackstack ghcican get confused when trying to directly load a package that generatesProto.*modules (for example:stack ghci <proto-package>). To work around this issue, run instead:And then manually import the generated modules within ghci, for example:
Alternately, you can make those modules available at the same time as another local package, by running:
Linking errors
Due to the limitations of how we can specify the dependencies of Setup files, stack may try to link them against the
terminfopackage. You may get an error fromstack buildsimilar to:On a Debian based system (like Ubuntu), the remedy is: