Cap'n Proto for Haskell https://github.com/zenhack/haskell-capnp
|Latest on Hackage:||0.4.0.0|
This package is not currently in any snapshots. If you're interested in using it, we recommend adding it to Stackage Nightly. Doing so will make builds more reliable, and allow stackage.org to host generated Haddocks.
A Haskell library for the Cap’N Proto Cerialization and RPC protocol.
There is a module
Capnp.Tutorial which contains an introduction
to the library; users are strongly encouraged to read this first, as
the reference documentation can be bewildering without that context.
Serialization support works, with some limitations:
- Generated schema currently ignore type parameters (#29).
- We do not support define custom default values for fields of pointer type; see (#28).
- We currently do not correctly handle decoding lists of structs from non-composite lists (#27). This means that, contrary to the protocol evolution rules, it is not safe to change a field from type List(T) (where T is any non-struct type) to a list of a struct type.
Level 1 RPC support is implemented and usable, though there are a couple gaps in the API. It should be considered alpha quality for now. Specific things to be aware of:
- The implementation is not robust against resource exhaustion attacks; for now users are strongly discouraged from using it to do RPC with untrusted peers.
- While most of the machinery for it is in place, the API does not currently expose a way to do field projection on remote promises. As a consequence, actually pipelining method calls is not currently possible, so the library is currently best suited to environments which are already low-latency.
The API is considered unstable. It will likely see changes, for the sake of polish, consistency, etc. as well as to improve performance and accommodate more features as we add them.
- RPC support! This should be considered alpha quality for now. The API will likely change substantially.
- Many bug fixes; users are strongly encouraged to upgrade.
- Reorganization of the module hierarchy:
- Generated code is now placed under
Capnp.Gen, rather than
Dataprefix has been removed from the
- Generated code is now placed under
- The included generated modules for the core schema have been updated to those shipped with version 0.7 of the reference implementation.
- Other miscellaneous API Changes:
createPurecan now be used with any instance of
MonadThrow, not just
LimitT mis now an instance of
MonadIO, provided that
mis an instance.
- More type class instances from elsewhere in the library are
re-exported via the
IsPtrtype class has been split into
ToPtr. Most user code should not care about this.
- Generated high-level types no longer have Read instances; interfaces make this problematic.
- Getters for anonymous unions are now
newMessagenow accepts an optional size hint.
- Instances of
Cerializenow exist/are generated for
(Vector (Vector (Vector ...)))up to a reasonable depth.
- Other improvements not directly reflected in the API:
- The allocation strategy has changed to reduce unnecessary copying.
- It is now possible to create messages with a size > 2GiB. Note that individual segments are still limited.
- Instances of some type classes are no longer generated for “second class” types (i.e. types which cannot appear as stand-alone definitions in schema files – groups and unions).
has_*functions are now only generated for pointer fields.
- Various non-functional changes in the output of the code generator.
- We now generate constants for (most) pointer types; previously constants defined in a schema would not result in any generated code (#41).
set_*functions now check if the arguments are in the same message, and copy if need be (#34).
MutMsgis now an instance of
Data.Capnp.Untypedis now a type family, rather than a multi-parameter type class. This improves inference and removes some superfluous generalization.
- The module
Data.Capnp.Purehas been folded into
Data.Capnp. If you were previously using the
Datatype aliases it exported, you should instead use
Data.Capnpare types from the low-level API.
- Redesign the ‘Mutable’ type class’s API.
- Provide helpers for doing zero-copy message creation in pure code.
- General improvements to the documentation.
- First release; basic read & write support, serialization only.