summaryrefslogtreecommitdiffstats
path: root/lib/account/type.ml
blob: ad7a46e14c5e225006045a1320ada4322f4b7eec (about) (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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