diff options
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 | ||