Declarative CSV codecs
0
fork

Configure Feed

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

Fix csvt merlint: rename get_col→col, add pp, fix docs

- get_col → col, find_col → col_index (redundant prefixes)
- Add pp : 'a t Fmt.t for the main codec type
- Add doc comments to fuzz/test .mli files
- Fix nullable_float/nullable_int doc format

+18
+3
fuzz/fuzz_csvt.mli
··· 1 + (** Fuzz tests for CSV codecs. *) 2 + 1 3 val suite : string * Alcobar.test_case list 4 + (** [suite] is the fuzz test suite. *)
+9
lib/csvt.ml
··· 97 97 | Dec_fun f -> f 98 98 | Dec_app (f, arg) -> (apply_dict f dict) (Option.get (Dict.find arg dict)) 99 99 100 + let rec pp : type a. a t Fmt.t = 101 + fun ppf t -> 102 + match t with 103 + | String _ -> Fmt.string ppf "field" 104 + | Map m -> pp ppf m.dom 105 + | Obj m -> 106 + let names = List.map (fun (Mem_dec mm) -> mm.name) m.mem_decs in 107 + Fmt.pf ppf "row(%s)" (String.concat ", " names) 108 + 100 109 (* {1 Decode and encode} 101 110 102 111 The CSV equivalents of the paper's [decode] and [encode] functions,
+3
lib/csvt.mli
··· 52 52 type 'a t 53 53 (** The type of CSV codecs mapping CSV data to OCaml values of type ['a]. *) 54 54 55 + val pp : 'a t Fmt.t 56 + (** [pp ppf c] formats the codec kind. *) 57 + 55 58 (** {1:field Field Codecs} *) 56 59 57 60 val string : string t
+3
test/test_csvt.mli
··· 1 + (** Unit tests for CSV codecs. *) 2 + 1 3 val suite : string * unit Alcotest.test_case list 4 + (** [suite] is the test suite. *)