-
We can remove an
assert_falseby puttingXPairin the hashtbl:type xpair = XPair : (_ * _) ty' -> xpair let tpair : type a b. a ty' -> b ty' -> (a * b) ty' = fun a b -> let key = (Xid a.id, Xid b.id) in try let (XPair r) = Hashtbl.find tpair_table key in let TPair (a', b') = r.value in match (eq_id a.id a'.id, eq_id b.id b'.id) with | Some Eq, Some Eq -> r | _ -> assert false with Not_found -> let r = {id= gen (); value= TPair (a, b)} in Hashtbl.add tpair_table key (XPair r) ; rThe other one is indeed based on the fact that passed parameters are themselves hashcons'ed and I don't think it's possible to enforce this in the type system.
Please register or sign in to comment