pa-field-parser 0.1.0.0 → 0.1.0.1
raw patch · 2 files changed
+52/−1 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- README.md +51/−0
- pa-field-parser.cabal +1/−1
README.md view
@@ -0,0 +1,51 @@+# pa-field-parser++A small library for “vertical parsing” of values.++Traditional parsers are “horizontal” parsers, they take a flat list of tokens and produce structure:++<pre><code>+[ token1 token2 token3 token4 token5 ]+----> horizontal parser++result:++- token1+|+`-- token2+|+`-- token3+ |+ `-- token 4 -- token 5+</code></pre>++A `FieldParser` is a “vertical” parser. Once you have some low-level type in hand, usually you want to do some more checks, to “upgrade” it so to say:++<pre><code>+ Integer+ ^+ | signedDecimal+ |+ Text+ ^+ | utf8+ |+ByteString+</code></pre>++As a `FieldParser`, this would look like:++```haskell+utf8 :: FieldParser ByteString Text+signedDecimal :: FieldParser Text Integer++(utf8 >>> signedDecimal) :: FieldParser ByteString Integer+```++`>>>` is from `Control.Category`, but `Profunctor` is also available to map over the left and right arguments.++When run, this produces either a value or a helpful error message.++They can be freely combined with other libraries, and act as a nice adapter between them. For example, the JSON-related functions integrate with `aeson-better-errors` and any `FieldParser Value a` can be converted to a `FromJSON` instance for `aeson`. `attoparsec` is also available to easily turn bytes or text parsers into `FieldParser`s.++You can use this library as-is, but the design is easily adaptable to your codebase, the idea is very simple. Feel free to copy and paste what you need.
pa-field-parser.cabal view
@@ -1,7 +1,7 @@ cabal-version: 3.0 -- !!! ATTN: file autogenerated from pa-template.cabal.mustache on toplevel !!! name: pa-field-parser-version: 0.1.0.0+version: 0.1.0.1 synopsis: “Vertical” parsing of values description: license: BSD-3-Clause