diff options
| author | Rutger Broekhoff | 2026-03-09 22:29:18 +0100 |
|---|---|---|
| committer | Rutger Broekhoff | 2026-03-09 22:29:18 +0100 |
| commit | c90ff5253efd858a2bf0c20eaa2ee9763a402783 (patch) | |
| tree | d1c5ab837ece7034d882368f1beeeb56b934ac4d /lib/account/type.ml | |
| parent | 2f94997e2befc70ada84bd04a56831efe2747220 (diff) | |
| download | rdcapsis-c90ff5253efd858a2bf0c20eaa2ee9763a402783.tar.gz rdcapsis-c90ff5253efd858a2bf0c20eaa2ee9763a402783.zip | |
oha!
Diffstat (limited to 'lib/account/type.ml')
| -rw-r--r-- | lib/account/type.ml | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/account/type.ml b/lib/account/type.ml new file mode 100644 index 0000000..ad7a46e --- /dev/null +++ b/lib/account/type.ml | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | type t = Type_hierarchy.path [@@deriving equal] | ||
| 2 | |||
| 3 | let rec base (t : t) : t = | ||
| 4 | match Type_hierarchy.super t with | ||
| 5 | | None -> (* [t] is a base type *) t | ||
| 6 | | Some t' -> base t' | ||
| 7 | |||
| 8 | (** [a] is a (strict) supertype of [b] *) | ||
| 9 | let is_super t ~super ~strict = | ||
| 10 | Type_hierarchy.is_prefix super ~prefix:t | ||
| 11 | && | ||
| 12 | (* strict → t ≠ super *) | ||
| 13 | ((not strict) || not ([%equal: t] t super)) | ||
| 14 | |||
| 15 | let polarity = Type_hierarchy.polarity | ||