Skip to content

Commit 950b23b

Browse files
committed
release 0.1.1
1 parent 8ccc8aa commit 950b23b

File tree

5 files changed

+37
-47
lines changed

5 files changed

+37
-47
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.1.1 (2023-07-20)
2+
* add work-in-progress store-style generic `foldMap`, encoding constructors by
3+
their index, at `Generic.Data.Function.FoldMap.SumConsByte`
4+
15
## 0.1.0 (2023-06-23)
26
Initial release.
37

README.md

Lines changed: 30 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,36 @@ Haskell data types. We handle the sums of products representation; you only need
77
to pass a handful of definitions. Obtain simple, type-safe generic
88
serializers/reducers and parsers for almost zero effort.
99

10+
Well, OK, so really this is a generic binary serialization library. It just so
11+
happens that the generics look like `foldMap` and `traverse`.
12+
13+
## Really?
14+
Kind of. We only handle *sequential concatenation*, being cleanly represented by
15+
builtin type classes. Weirder cases like JSON parsing/serialization have more
16+
going on, and aren't sensibly discussed generically. So you are probably only
17+
going to use this with bytestrings and simple binary formats.
18+
19+
## Why?
20+
It is 2023. There are a number of competing parsing and serialization Haskell
21+
libraries, recently some notable high-performance ones. These are often fairly
22+
experimental. Maybe you want some generics to benchmark some real-world use case
23+
against popular libraries like binary and cereal. But maybe generics aren't
24+
provided. Shucks.
25+
26+
That's a shame, because a binary/cereal-esque generic binary parser or
27+
serializer doesn't have much work to do:
28+
29+
* traverse the generic sum-of-products tree of the given type left to right
30+
* defer to the appropriate type class for base cases
31+
32+
Sum types necessitate a little more work. Otherwise, most such parsers and
33+
serializers look fairly comparable to each other. Why are we rewriting this
34+
stuff over and over again?
35+
36+
generic-data-functions provides *reusable generics* which have holes in for your
37+
favorite parsers and serializers. Fill out a few definitions to receive a fresh
38+
new generic instance for your own library, without all the boilerplate.
39+
1040
## Functions
1141
### `foldMap` (L->R)
1242
```haskell
@@ -45,47 +75,3 @@ life, Jim.
4575

4676
## License
4777
Provided under the MIT license. See `LICENSE` for license text.
48-
49-
---
50-
51-
senserial is a small library providing reusable generics for (binary) parsers
52-
and serializers. No need to muddle through boilerplate generics that look the
53-
same as everyone else's; just provide a few definitions and senserial can give
54-
you powerful generic instances.
55-
56-
Currently an unofficial library, distributed as part of binrep. Reader, please
57-
let the author know if you'd like it released separately.
58-
59-
## Why?
60-
It is 2023. There are a number of competing parsing and serialization Haskell
61-
libraries, and some notable high-performance binary serialization libraries.
62-
These are often fairly experimental. Maybe you want some generics to benchmark
63-
some real-world use case against popular libraries like binary and cereal. But
64-
maybe generics aren't provided. Shucks.
65-
66-
That's a shame, because a pure generic binary parser or serializer doesn't have
67-
much work to do:
68-
69-
* traverse the generic sum-of-products tree of the given type left to right
70-
* defer to the appropriate type class for base cases
71-
72-
Sum types necessitate a little more work. Otherwise, most generic binary parsers
73-
and serializers look fairly comparable to each other. Why are we rewriting this
74-
stuff over and over again?
75-
76-
senserial provides *reusable generics* which have holes in for your favourite
77-
parsers and serializers. Fill out a few definitions to receive a fresh new
78-
generic instance for your own library, without all the boilerplate.
79-
80-
## Really?
81-
Kind of. In reality, this library can only handle cases where no configuration
82-
is needed other than what is provided in the data type itself. senserial
83-
provides the generic traversal, and you can't alter that. Plus, the only
84-
often rewritten and straightforward traversal I can think of is sequential field
85-
concatenation. So though the code isn't limited to bytestrings and binary
86-
serialization formats, you will have trouble using it for anything else, because
87-
anything else will probably require a very different traversal (e.g. JSON
88-
serialization).
89-
90-
In short, the primary use of this library is to pull out the common generics
91-
patterns from binary serialization libraries for easy reuse.

TODO.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# generic-data-functions to-dos
2-
* release on Hackage, it's super useful
2+
* add tests (steal some from binrep?)
33
* provide a different `traverse` that inspects field names, to eventually
44
replicate Gabriella's optparse-generic
55
* provide a mixed sum & non-sum generic derivation like my original (& Aeson)

generic-data-functions.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ cabal-version: 1.12
55
-- see: https://github.com/sol/hpack
66

77
name: generic-data-functions
8-
version: 0.1.0
8+
version: 0.1.1
99
synopsis: Familiar functions lifted to generic data types
1010
description: Please see README.md.
1111
category: Data, Serialization

package.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: generic-data-functions
2-
version: 0.1.0
2+
version: 0.1.1
33
synopsis: Familiar functions lifted to generic data types
44
description: Please see README.md.
55
extra-source-files:

0 commit comments

Comments
 (0)