git.iko.soy/rowtype-yoga/purescript-protobuf
on master help sign in
Polishing
9cbb972James Brock
README.md+5−5
@@ -44,7 +44,7 @@ We also have our own unit tests, see `test/README.md` in this repository.
44
44
45The `shell.nix` environment provides
45The `shell.nix` environment provides
46
46
47−* The Purescript toolchain: *purs*, *spago*, and *npm*.
47+* The Purescript toolchain: `purs`, `spago`, and `npm`.
48* The [`protoc`](https://developers.google.com/protocol-buffers/docs/proto3?hl=en#generating) compiler
48* The [`protoc`](https://developers.google.com/protocol-buffers/docs/proto3?hl=en#generating) compiler
49* The `protoc-gen-purescript` executable plugin for `protoc` on the `PATH` so that
49* The `protoc-gen-purescript` executable plugin for `protoc` on the `PATH` so that
50 [`protoc` can find it](https://developers.google.com/protocol-buffers/docs/reference/cpp/google.protobuf.compiler.plugin).
50 [`protoc` can find it](https://developers.google.com/protocol-buffers/docs/reference/cpp/google.protobuf.compiler.plugin).
@@ -72,10 +72,10 @@ to your `PATH`.
72
72
73## Writing programs with the generated code
73## Writing programs with the generated code
74
74
75−The code generator will use the `package` import statement in the schema `.proto` file
75+The code generator will use the `package` import statement in the `.proto` file
76and the base `.proto` file name as the Purescript module name for that file.
76and the base `.proto` file name as the Purescript module name for that file.
77
77
78−A message in a `shapes.proto` file declared as
78+A message in a `shapes.proto` descriptor file declared as
79
79
80```
80```
81package interproc;
81package interproc;
@@ -96,8 +96,8 @@ generated `shapes.Interproc.purs` file.
96 ```
96 ```
97
97
98 The message data type will also include an `__unknown_fields` array field for
98 The message data type will also include an `__unknown_fields` array field for
99− holding received fields which were not in the schema `.proto` file. We can
99+ holding received fields which were not in the descriptor `.proto` file. We can
100− completely ignore this field if we want to.
100+ completely ignore `__unknown_fields` if we want to.
101
101
1022. A message maker which constructs a message from a `Record`
1022. A message maker which constructs a message from a `Record`
103 with some message fields
103 with some message fields
src/Protobuf/Common.purs+1−1
@@ -1,4 +1,4 @@
1−-- | Do not import this module.
1+-- | You almost never need to `import` this module.
2-- | See package README for explanation.
2-- | See package README for explanation.
3module Protobuf.Common
3module Protobuf.Common
4( FieldNumber
4( FieldNumber
src/Protobuf/Decode.purs+1−1
@@ -1,6 +1,6 @@
1-- | Primitive parsers for decoding Google Protocol Buffers.
1-- | Primitive parsers for decoding Google Protocol Buffers.
2-- |
2-- |
3−-- | Do not import this module.
3+-- | You almost never need to import this module.
4-- | See package README for explanation.
4-- | See package README for explanation.
5module Protobuf.Decode
5module Protobuf.Decode
6( double
6( double
src/Protobuf/Decode32.purs+1−1
@@ -1,6 +1,6 @@
1-- | Primitive `UInt`-based parsers for decoding Google Protocol Buffers.
1-- | Primitive `UInt`-based parsers for decoding Google Protocol Buffers.
2-- |
2-- |
3−-- | Do not import this module.
3+-- | You almost never need to import this module.
4-- | See package README for explanation.
4-- | See package README for explanation.
5-- |
5-- |
6-- | There is no `varint32` in the Protbuf spec, this is
6-- | There is no `varint32` in the Protbuf spec, this is
src/Protobuf/Decode64.purs+1−1
@@ -1,6 +1,6 @@
1-- | Primitive `Long`-based parsers for decoding Google Protocol Buffers.
1-- | Primitive `Long`-based parsers for decoding Google Protocol Buffers.
2-- |
2-- |
3−-- | Do not import this module.
3+-- | You almost never need to import this module.
4-- | See package README for explanation.
4-- | See package README for explanation.
5module Protobuf.Decode64
5module Protobuf.Decode64
6( zigzag64
6( zigzag64
src/Protobuf/Encode.purs+1−1
@@ -1,6 +1,6 @@
1-- | Primitive builders for encoding Google Protocol Buffers.
1-- | Primitive builders for encoding Google Protocol Buffers.
2-- |
2-- |
3−-- | Do not import this module.
3+-- | You almost never need to import this module.
4-- | See package README for explanation.
4-- | See package README for explanation.
5-- |
5-- |
6-- | Primed (') encoder functions encode without the tag, for packed
6-- | Primed (') encoder functions encode without the tag, for packed
src/Protobuf/Encode32.purs+1−1
@@ -1,6 +1,6 @@
1-- | Primitive `UInt`-based builders for encoding Google Protocol Buffers.
1-- | Primitive `UInt`-based builders for encoding Google Protocol Buffers.
2-- |
2-- |
3−-- | Do not import this module.
3+-- | You almost never need to import this module.
4-- | See package README for explanation.
4-- | See package README for explanation.
5-- |
5-- |
6-- | There is no `varint32` in the Protbuf spec, this is
6-- | There is no `varint32` in the Protbuf spec, this is
src/Protobuf/Encode64.purs+1−1
@@ -1,6 +1,6 @@
1-- | Primitive `Long`-based builders for encoding Google Protocol Buffers.
1-- | Primitive `Long`-based builders for encoding Google Protocol Buffers.
2-- |
2-- |
3−-- | Do not import this module.
3+-- | You almost never need to import this module.
4-- | See package README for explanation.
4-- | See package README for explanation.
5module Protobuf.Encode64
5module Protobuf.Encode64
6( zigzag64
6( zigzag64
src/Protobuf/Library.purs+1−1
@@ -15,7 +15,7 @@ import Control.Monad.Trans.Class (lift)
15import Data.Either (Either(..))
15import Data.Either (Either(..))
16import Data.Maybe (Maybe(..))
16import Data.Maybe (Maybe(..))
17import Protobuf.Common (Bytes(..), class Default, default, isDefault, fromDefault, toDefault)
17import Protobuf.Common (Bytes(..), class Default, default, isDefault, fromDefault, toDefault)
18−import Protobuf.Runtime (label, UnknownField(..), manyLength)
18+import Protobuf.Runtime (label, manyLength)
19import Text.Parsing.Parser (ParserT, fail)
19import Text.Parsing.Parser (ParserT, fail)
20
20
21-- | Lift an `ExceptT String m` computation into a `ParserT`.
21-- | Lift an `ExceptT String m` computation into a `ParserT`.
src/Protobuf/Runtime.purs+3−4
@@ -1,6 +1,6 @@
1-- | This module is for import by the generated .purs message modules.
1-- | This module is for import by the generated .purs message modules.
2-- |
2-- |
3−-- | Do not import this module.
3+-- | You almost never need to import this module.
4-- | See package README for explanation.
4-- | See package README for explanation.
5module Protobuf.Runtime
5module Protobuf.Runtime
6( parseMessage
6( parseMessage
@@ -79,8 +79,8 @@ parseMessage construct default parseField length = do
79-- | Parse position, zero-based, unlike Text.Parsing.Parser.Position which is one-based.
79-- | Parse position, zero-based, unlike Text.Parsing.Parser.Position which is one-based.
80type Pos = Int
80type Pos = Int
81
81
82−-- | We want Int FieldNumber to pass to parseField so that we can pattern
82+-- | We want an Int FieldNumber to pass to parseField so that we can pattern
83−-- | match on Int literals. UInt doesn't export any constructors, so can't
83+-- | match on Int literals. UInt doesn't export any constructors, so we can’t
84-- | pattern match on it.
84-- | pattern match on it.
85type FieldNumberInt = Int
85type FieldNumberInt = Int
86
86
@@ -253,7 +253,6 @@ putEnum' x = Encode.varint64 (fromLowHighBits x_low x_high :: Long Unsigned)
253 x_high = highBits x_slong
253 x_high = highBits x_slong
254 x_low = lowBits x_slong
254 x_low = lowBits x_slong
255
255
256−
257parseEnum :: forall m a. MonadEffect m => BoundedEnum a => ParserT DataView m a
256parseEnum :: forall m a. MonadEffect m => BoundedEnum a => ParserT DataView m a
258parseEnum = do
257parseEnum = do
259 -- “Enumerator constants must be in the range of a 32-bit integer.”
258 -- “Enumerator constants must be in the range of a 32-bit integer.”