package toml

  1. Overview
  2. Docs
Library for TOML with a parser, a serializer and a printer

Install

Dune Dependency

Authors

Maintainers

Sources

7.1.0.tar.gz
sha256=1d4e9c16ed9e24d46dd757ce94adc7fc8b2068eb5ff7cd2a70fce08135a752ef
sha512=9cb98e4a9c4a01acf5ceeac836fe0dc4d341662f9b3ce6803e9d14499bcb450441111247159bdbc5c25d4618b8c1f088d206da702bef12ea1ca8781607d26774

doc/src/toml/compare.ml.html

Source file compare.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
let rec list_compare ~f l1 l2 =
  match (l1, l2) with
  | head1 :: tail1, head2 :: tail2 ->
    let comp_result = f head1 head2 in
    if comp_result != 0 then comp_result else list_compare ~f tail1 tail2
  | [], _head2 :: _tail2 -> -1
  | _head1 :: _tail1, [] -> 1
  | [], [] -> 0

let rec value (x : Types.value) (y : Types.value) =
  match (x, y) with
  | TArray x, TArray y -> array x y
  | TTable x, TTable y -> table x y
  | _, _ -> compare x y

and array (x : Types.array) (y : Types.array) =
  match (x, y) with
  | NodeTable nt1, NodeTable nt2 -> list_compare ~f:table nt1 nt2
  | _ -> compare x y

and table (x : Types.table) (y : Types.table) = Types.Table.compare value x y
OCaml

Innovation. Community. Security.