diff options
| author | Marcos Magueta <maguetamarcos@gmail.com> | 2026-03-06 04:10:31 -0300 |
|---|---|---|
| committer | Marcos Magueta <maguetamarcos@gmail.com> | 2026-03-06 04:10:31 -0300 |
| commit | 5bbbbc976d25859082014f3720b82bcd2d05a2f0 (patch) | |
| tree | 91c8a230260006156ef58fcc004775d1387de94e /lib/conventions.ml | |
| parent | 1f084d995444683e2885beb6e12eeee6df1241d3 (diff) | |
| download | Sakura-5bbbbc976d25859082014f3720b82bcd2d05a2f0.tar.gz Sakura-5bbbbc976d25859082014f3720b82bcd2d05a2f0.zip | |
encode relations on module base
Diffstat (limited to '')
| -rw-r--r-- | lib/conventions.ml | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/conventions.ml b/lib/conventions.ml new file mode 100644 index 0000000..74f6cc3 --- /dev/null +++ b/lib/conventions.ml @@ -0,0 +1,26 @@ +module Hash = struct + type t = Interop.Sha256.t + let hash_text text = Interop.Sha256.compute_hash (Bytes.of_string text) + let compare = String.compare +end + +module Name = struct + type t = string +end + +module Cardinality = struct + type t = Finite of int | AlephZero | Continuum +end + +module AbstractValue = struct + module StringMap = Map.Make(String) + type t = { + fields: string StringMap.t; + } + let hash_text value = + let folder (name: string) (value: string) (acc: Hash.t) = + Hash.(hash_text (acc ^ hash_text name ^ hash_text value)) + in StringMap.fold folder value.fields "" + let compare a b = + StringMap.compare String.compare a.fields b.fields +end
\ No newline at end of file |
