From c90ff5253efd858a2bf0c20eaa2ee9763a402783 Mon Sep 17 00:00:00 2001 From: Rutger Broekhoff Date: Mon, 9 Mar 2026 22:29:18 +0100 Subject: oha! --- lib/account/type.ml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 lib/account/type.ml (limited to 'lib/account/type.ml') 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 @@ +type t = Type_hierarchy.path [@@deriving equal] + +let rec base (t : t) : t = + match Type_hierarchy.super t with + | None -> (* [t] is a base type *) t + | Some t' -> base t' + +(** [a] is a (strict) supertype of [b] *) +let is_super t ~super ~strict = + Type_hierarchy.is_prefix super ~prefix:t + && + (* strict → t ≠ super *) + ((not strict) || not ([%equal: t] t super)) + +let polarity = Type_hierarchy.polarity -- cgit v1.3