1
0
Fork 0

useless application

This commit is contained in:
Mylloon 2024-04-27 12:33:58 +02:00
parent cc709fb5b3
commit fd68a06c08
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -22,20 +22,25 @@ let rec apply subst = function
| Type.Arrow (ty1, ty2) -> Type.Arrow (apply subst ty1, apply subst ty2) | Type.Arrow (ty1, ty2) -> Type.Arrow (apply subst ty1, apply subst ty2)
;; ;;
(** Compose two substitutions *) (** Compose two substitutions, last with priority *)
let compose s2 s1 = let compose s2 s1 =
IdentifierMap.merge let merger =
(fun _ ty1 ty2 -> IdentifierMap.merge
match ty1, ty2 with (* ID type_s1 type_s2 *)
(* If we have 2, we pick one of them *) (fun _ ty1 ty2 ->
| Some ty1', Some _ -> Some (apply s2 ty1') match ty1, ty2 with
(* If we have 1, we pick the one we have *) (* Dans ce cas, on donne la priorité à s1 *)
| Some ty1', None -> Some (apply s2 ty1') | Some ty1', Some _ -> Some ty1'
| None, Some ty2' -> Some (apply s2 ty2') (* Utilisation de la substitution que l'on à déjà *)
(* If we have 0, we return nothing *) | Some ty1', None -> Some ty1'
| None, None -> None) | None, Some ty2' -> Some ty2'
s1 (* Variable untyped *)
s2 | None, None -> None)
s1
s2
in
print_endline "wow!";
merger
;; ;;
let to_string map = let to_string map =