ekmett / bytes

Serialization primitives that work with both cereal and binary.
http://hackage.haskell.org/package/bytes
Other
22 stars 13 forks source link

Possibly create other `MonadGet` and `MonadPut` instances #25

Open pchiusano opened 9 years ago

pchiusano commented 9 years ago

Something that is nice about having MonadGet and MonadPut as classes is you can use the same serialization logic for different purposes. For instance, you can create a MonadPut instance based on a cryptographic hash accumulator, and now your serialization code for your type doubles for creating hashes. Maybe a bit ad hoc, but it works great!

Here are a couple other ideas for instances:

Not sure if you'd want include any of these in this package, but just wanted to get your thoughts. Maybe such instances belong in a separate package that depends on bytes?

Ericson2314 commented 8 years ago

@pchiusano you might be interested in https://github.com/Ericson2314/haskell-vcache/blob/master/generic-store/hsrc_lib/Database/Generic.hs, the immutable subset I envision for exactly the sort of cross-platform content-addressable-store that you want Unison to use, supporting multiple back ends like https://github.com/mirage/irmin.

edit oh, and this does indeed extend bytes's monads to save me a lot of needless repetition :).