aboutsummaryrefslogtreecommitdiffstats
path: root/lib/conventions.ml
diff options
context:
space:
mode:
authorMarcos Magueta <maguetamarcos@gmail.com>2026-06-23 23:53:26 -0300
committerGitHub <noreply@github.com>2026-06-23 23:53:26 -0300
commitc284fcd570342c31bc21169960579a20a763e32e (patch)
treece7485055116d794c55090ad0978e0b3f5ff4c2a /lib/conventions.ml
parentb81586ee4a0543a5f9866586c78dccdd6328934a (diff)
downloadSakura-c284fcd570342c31bc21169960579a20a763e32e.tar.gz
Sakura-c284fcd570342c31bc21169960579a20a763e32e.zip
Format
Diffstat (limited to '')
-rw-r--r--lib/conventions.ml24
1 files changed, 10 insertions, 14 deletions
diff --git a/lib/conventions.ml b/lib/conventions.ml
index 9e18762..70f33cf 100644
--- a/lib/conventions.ml
+++ b/lib/conventions.ml
@@ -15,8 +15,7 @@ end
module Cardinality = struct
open Sexplib.Std
- type t = Finite of int | ConstrainedFinite | AlephZero | Continuum
- [@@deriving sexp]
+ type t = Finite of int | ConstrainedFinite | AlephZero | Continuum [@@deriving sexp]
end
module Purity = struct
@@ -27,8 +26,7 @@ module AbstractValue = struct
type t = Obj.t
type value_type = Int | String | Float | Opaque
- let hash (elem : t) =
- Sha256.to_hex (Sha256.string (Bytes.to_string (Marshal.to_bytes elem [])))
+ let hash (elem : t) = Sha256.to_hex (Sha256.string (Bytes.to_string (Marshal.to_bytes elem [])))
let type_of (elem : t) : value_type =
let tag = Obj.tag elem in
@@ -43,17 +41,15 @@ module AbstractValue = struct
| Int -> Atom (string_of_int (Obj.obj v : int))
| String -> Atom (Obj.obj v : string)
| Float ->
- let f = (Obj.obj v : float) in
- if Float.is_nan f || Float.is_infinite f
- then Atom "nan"
- else Atom (string_of_float f)
+ let f = (Obj.obj v : float) in
+ if Float.is_nan f || Float.is_infinite f then Atom "nan" else Atom (string_of_float f)
| Opaque -> Atom "<opaque>"
let equal a b =
- match (type_of a, type_of b) with
- | (Int, Int) -> (Obj.obj a : int) = (Obj.obj b : int)
- | (String, String) -> (Obj.obj a : string) = (Obj.obj b : string)
- | (Float, Float) -> (Obj.obj a : float) = (Obj.obj b : float)
- | (Opaque, Opaque) -> false
- | (_, _) -> false
+ match type_of a, type_of b with
+ | Int, Int -> (Obj.obj a : int) = (Obj.obj b : int)
+ | String, String -> (Obj.obj a : string) = (Obj.obj b : string)
+ | Float, Float -> (Obj.obj a : float) = (Obj.obj b : float)
+ | Opaque, Opaque -> false
+ | _, _ -> false
end