Ecosyste.ms: Packages

An open API service providing package, version and dependency metadata of many open source software ecosystems and registries.

Top 7.2% dependent packages on hackage.haskell.org

hackage.haskell.org : winery

Please see the README on GitHub at https://github.com/fumieval/winery#readme [Last Documentation] Package maintainers For package maintainers and hackage trustees Candidates winery is a serialisation library focusing on performance, compactness and compatibility. The primary feature is that metadata (types, field names, etc) are packed into one schema. A number of formats, like JSON and CBOR, attach metadata for each value: [{"id": 0, "name": "Alice"}, {"id": 1, "name": "Bob"}] In contrast, winery stores them separately, eliminating redundancy while guaranteeing well-typedness: Unlike other libraries that don't preserve metadata (e.g. binary, cereal, store) at all, winery also allows readers to decode values regardless of the current implementation. The interface is simple; serialise encodes a value with its schema, and deserialise decodes a ByteString using the schema in it. It's also possible to serialise schemata and data separately. serialiseSchema encodes a schema and its version number into a ByteString, and serialiseOnly serialises a value without a schema. In order to decode data generated this way, pass the result of deserialiseSchema to getDecoder. Finally run evalDecoder to deserialise them. The recommended way to create an instance of Serialise is to use DerivingVia. for single-constructor records, or just for any ADT. The former explicitly describes field names in the schema, and the latter does constructor names. If you want to customise one of the methods, you can use bundleVia to supply the rest of definitions. If the representation is not the same as the current version (i.e. the schema is different), the data cannot be decoded directly. This is where extractors come in. Extractor parses a schema and returns a function which gives a value back from a Term. You can build an extractor using combinators such as extractField, extractConstructor, etc. If you want to customise the extractor, the pair of gvariantExtractors and buildVariantExtractors is handy. Extractor is Alternative, meaning that multiple extractors (such as a default generic implementation and fallback plans) can be combined into one. Altering an instance for a record type is a little bit tricky. HKD can represent a record where each field is Subextractor instead of the orignal type. The barbies-th allows us to derive it from a plain declaration. Obtain a record of extractors using bextractors :: forall b. (AllB Serialise b, ...) => b Subextractor, update it as necessary, then build an extractor for an entire record by buildRecordExtractor. More generic instance (for covered types) can be defined as below: Term can be deserialised from any winery data. It can be pretty-printed using the Pretty instance: You can use the winery command-line tool to inspect values. At the moment, the following queries are supported: A useful library should also be fast. Benchmarking encoding/decoding of the following datatype. Here's the result:

Registry - Source - Homepage - JSON
purl: pkg:hackage/winery
Keywords: bsd3, codec, data, library, parsing, program, serialization
License: BSD-3-Clause
Latest release: over 3 years ago
First release: almost 6 years ago
Dependent packages: 2
Dependent repositories: 4
Downloads: 8,247 total
Stars: 89 on GitHub
Forks: 9 on GitHub
Total Commits: 305
Committers: 4
Average commits per author: 76.25
Development Distribution Score (DDS): 0.016
More commit stats: commits.ecosyste.ms
See more repository details: repos.ecosyste.ms
Last synced: 17 days ago

    Loading...
    Readme
    Loading...