git.iko.soy/rowtype-yoga/purescript-protobuf
on master help sign in
WIP
commite11a26635bfe1c76fc89eb76cd70bb8cb9284b3d authorJames Brock <jamesbrock@gmail.com> dateSun 11 Apr 2021, 19:12 (6 years ago) parent5365078
2 files changed+13−4
README.md+11−2 conformance/README.md+2−2
README.md+11−2
@@ -172,10 +172,19 @@ Fortunately, we are already in the `ParserT` monad,
172172so we can do better than “validation.”
173173[Parse, don't validate](https://lexi-lambda.github.io/blog/2019/11/05/parse-don-t-validate/).
174174
175−We will construct and return a tuple
175+We will construct and return a `Tuple`
176176with the width and height of the `Rectangle`. For this step,
177177[pattern matching](https://github.com/purescript/documentation/blob/master/language/Pattern-Matching.md)
178−on the `Rectangle` message type works well, or we might want to use some of the
178+on the `Rectangle` message type works well.
179+
180+```purescript
181+ case rectangle of
182+ Rectangle { width: Just width, height: Just height } ->
183+ pure $ Tuple width height
184+ _ -> fail "Missing required width or height"
185+```
186+
187+Or we might want to use some of the
179188convenience parsing functions exported by `Protobuf.Library`, like `parseMaybe`.
180189
181190```purescript
conformance/README.md+2−2
@@ -13,5 +13,5 @@ nix-shell nix/conformance.nix
1313
1414[Conformance README](https://github.com/protocolbuffers/protobuf/tree/master/conformance)
1515
16−The `nix/protobuf.nix` derivation will build protobuf along with its
17−conformance test runners.
16+The derivations in `nix/protobuf.nix` will build `protobuf` and the
17+`conformance-test-runner`.