Native CBOR codec with type-safe combinators
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

ocaml-cbor: enable MDX on lib/value.mli, fix broken doc example

The Value example used 'Cbor.Map'/'Cbor.Text' (top-level constructors
that don't exist) and 'Cbor.int 30' (no such smart constructor). Open
Cbor at the top of the block, qualify the constructors as
Value.Map/Value.Text, and replace 'Cbor.int 30' with 'Value.Int
(Z.of_int 30)' which is the actual variant + zarith int. Add an
'assert false'-guarded match so the build catches drift in the Value.t
shape.

+14 -2
+4
lib/dune
··· 6 6 zarith 7 7 fmt 8 8 (re_export nox-loc))) 9 + 10 + (mdx 11 + (files value.mli) 12 + (libraries nox-cbor zarith))
+10 -2
lib/value.mli
··· 21 21 {2 Example} 22 22 23 23 {[ 24 + open Cbor 25 + 24 26 let person = 25 - Cbor.Map 27 + Value.Map 26 28 [ 27 - (Cbor.Text "name", Cbor.Text "Alice"); (Cbor.Text "age", Cbor.int 30); 29 + (Value.Text "name", Value.Text "Alice"); 30 + (Value.Text "age", Value.Int (Z.of_int 30)); 28 31 ] 32 + 33 + let () = 34 + match person with 35 + | Value.Map [ (Value.Text "name", _); (Value.Text "age", _) ] -> () 36 + | _ -> assert false 29 37 ]} *) 30 38 31 39 (** {1:types CBOR Data Items} *)