[dead] combinators for type conversion (serialization/deserialization) to/from several formats. See this blog post (outdated): http://cedeela.fr/universal-serialization-and-deserialization.html
I get an error when using cconv.ppx (installed-version: 0.3 [4.02.1]):
type t = string * int [@@deriving cconv]
ocamlfind ocamlc -package cconv.ppx x.ml -dsource
type t = (string* int)[@@deriving cconv]
let encode: _ CConv.Encode.encoder =
CConv.Encode.tuple
(fun (arg0,arg1) ->
[CConv.Encode.string.CConv.Encode.emit into arg0;
CConv.Encode.int.CConv.Encode.emit into arg1])
and decode: _ CConv.Decode.decoder =
let open CConv.Decode in
tuple
{
tuple_accept =
(fun src ->
fun args ->
match args with
| arg0::arg1::[] ->
((CConv.Decode.apply src CConv.Decode.string arg0),
(CConv.Decode.apply src CConv.Decode.int arg1))
| _ -> CConv.report_error "expected %d-ary tuple" 2)
}
File "x.ml", line 1, characters 0-40:
Error: This expression should not be a function, the expected type is
'a CConv.Encode.tuple_encoder
I get an error when using cconv.ppx (
installed-version: 0.3 [4.02.1]
):