aboutsummaryrefslogtreecommitdiffstats
path: root/lib/conventions.ml
diff options
context:
space:
mode:
authorMarcos Magueta <maguetamarcos@gmail.com>2026-04-03 16:17:38 -0300
committerMarcos Magueta <maguetamarcos@gmail.com>2026-04-03 16:17:38 -0300
commit63ae3c930de89af6f85229a467caa3f53cb844a2 (patch)
treecda4d513672f9fefa09c3a1dff69d8443890e224 /lib/conventions.ml
parentc5bc3a4992b4968780c286a084ad7c02b2b58f1e (diff)
downloadSakura-63ae3c930de89af6f85229a467caa3f53cb844a2.tar.gz
Sakura-63ae3c930de89af6f85229a467caa3f53cb844a2.zip
format
Diffstat (limited to 'lib/conventions.ml')
-rw-r--r--lib/conventions.ml15
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/conventions.ml b/lib/conventions.ml
index 60069b0..b6f82a5 100644
--- a/lib/conventions.ml
+++ b/lib/conventions.ml
@@ -1,5 +1,6 @@
module Hash = struct
type t = Interop.Sha256.t
+
let hash_text text = Interop.Sha256.compute_hash (Bytes.of_string text)
let compare = String.compare
let sexp_of_t = Sexplib.Std.sexp_of_string
@@ -7,21 +8,25 @@ end
module Name = struct
type t = string
+
let sexp_of_t = Sexplib.Std.sexp_of_string
end
module Cardinality = struct
type t = Finite of int | ConstrainedFinite | AlephZero | Continuum
+
let sexp_of_t = function
- | Finite n -> Sexplib.Sexp.(List [Atom "Finite"; Atom (string_of_int n)])
+ | Finite n -> Sexplib.Sexp.(List [ Atom "Finite"; Atom (string_of_int n) ])
| ConstrainedFinite -> Sexplib.Sexp.Atom "ConstrainedFinite"
- | AlephZero -> Sexplib.Sexp.Atom "AlephZero"
- | Continuum -> Sexplib.Sexp.Atom "Continuum"
+ | AlephZero -> Sexplib.Sexp.Atom "AlephZero"
+ | Continuum -> Sexplib.Sexp.Atom "Continuum"
end
module AbstractValue = struct
type t = Obj.t
- let hash (elem: t) = Interop.Sha256.compute_hash @@ Marshal.to_bytes elem []
+
+ let hash (elem : t) = Interop.Sha256.compute_hash @@ Marshal.to_bytes elem []
+
let sexp_of_t (v : t) =
let open Sexplib.Sexp in
if Obj.is_int v then Atom (string_of_int (Obj.obj v : int))
@@ -33,4 +38,4 @@ module AbstractValue = struct
if Float.is_nan f || Float.is_infinite f then Atom "nan"
else Atom (string_of_float f)
else Atom "<opaque>"
-end \ No newline at end of file
+end