Comments (6)
I like the idea of doing the chunked representation. I don't really see any problem with exposing both a chunked version of putListOf/getListOf, in addition to one that picks a sane default value. If you're interested in writing the patch, I'd be happy to take the contribution :)
from cereal.
I'd be happy to write up the patch. Just give me a while because I need to familiarize myself with the cereal
internals some more first.
from cereal.
You should be able to write it as something that makes iterated calls to putListOf/getListOf as a primitive, looping over its input and splitting at the chunk boundary using splitAt.
putChunkedListOf :: Int -> Putter a -> Putter [a]
putChunkedListOf clen f = loop
where
loop xs = do
let (as,bs) = splitAt clen xs
putListOf f as
unless (null bs) (loop bs)
from cereal.
Yeah, I wasn't going to do it exactly the way I wrote it. That was just
something I threw together for an example. Hand-writing the chunking
would also let me inline the code for marking the last chunk.
On 08/20/2012 02:19 PM, Trevor Elliott wrote:
You should be able to write it as something that makes iterated calls
to putListOf/getListOf as a primitive, looping over its input and
splitting at the chunk boundary using splitAt.putChunkedListOf :: Int -> Putter a -> Putter [a]
putChunkedListOf clen f = loop
where
loop xs = do
let (as,bs) = splitAt clen xs
putListOf f as
unless (null bs) (loop bs)—
Reply to this email directly or view it on GitHub
#6 (comment).
from cereal.
(I'm closing this as it seems like you'll submit a pull request when the feature is ready :)
from cereal.
Yeah, I will submit a pull request when it is ready.
from cereal.
Related Issues (20)
- Deserialization of Ratios with 0 denominator
- Export an `eof` getter that spits out the remaining bytestring HOT 5
- Build failure with GHC 9.4 HOT 3
- combining isEmpty with many causes an internal error HOT 2
- fails to build with ghc-9.6.3 HOT 1
- Support for Decimal128 HOT 1
- I can't just get the result and Builder out of Put. HOT 1
- Missing `Serialize` instance for `NonEmpty a` HOT 1
- Build error HOT 10
- Request for new release HOT 2
- Missing base Serialize instances: Identity, Const
- Upload GHC-8.8.1 changes to Hackage HOT 1
- Question about Generic serialiazation/deserialization, Not a bug (a priori) HOT 4
- [Question] Are serializations portable to other machines? HOT 2
- gPut depends on the nesting structure of :+:
- Missing getters for Int putters
- lookAhead and bytesRead HOT 2
- doc issue HOT 2
- Missing `instance Serialize Void`
- Cannot be built with GHC 9.2.0.20210821 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cereal.