| |
let type_instance (q, t) =
acyclic t;
let copy t = let t = repr t in t, tvar() in
let copied = List.map copy q in
let rec visit t =
let t = repr t in
try List.assq t copied with Not_found ->
begin match desc t with
| Tvar _ | Tcon (_, []) -> t
| Tcon (g, l) -> texp (Tcon (g, List.map visit l))
end in
visit t;; |
|