@@ -7,6 +7,36 @@ Haskell data types. We handle the sums of products representation; you only need
7
7
to pass a handful of definitions. Obtain simple, type-safe generic
8
8
serializers/reducers and parsers for almost zero effort.
9
9
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
+
10
40
## Functions
11
41
### ` foldMap ` (L->R)
12
42
``` haskell
@@ -45,47 +75,3 @@ life, Jim.
45
75
46
76
## License
47
77
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.
0 commit comments