useless application
This commit is contained in:
parent
cc709fb5b3
commit
fd68a06c08
1 changed files with 18 additions and 13 deletions
|
@ -22,20 +22,25 @@ let rec apply subst = function
|
|||
| 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 merger =
|
||||
IdentifierMap.merge
|
||||
(* ID type_s1 type_s2 *)
|
||||
(fun _ ty1 ty2 ->
|
||||
match ty1, ty2 with
|
||||
(* If we have 2, we pick one of them *)
|
||||
| Some ty1', Some _ -> Some (apply s2 ty1')
|
||||
(* If we have 1, we pick the one we have *)
|
||||
| Some ty1', None -> Some (apply s2 ty1')
|
||||
| None, Some ty2' -> Some (apply s2 ty2')
|
||||
(* If we have 0, we return nothing *)
|
||||
(* Dans ce cas, on donne la priorité à s1 *)
|
||||
| Some ty1', Some _ -> Some ty1'
|
||||
(* Utilisation de la substitution que l'on à déjà *)
|
||||
| Some ty1', None -> Some ty1'
|
||||
| None, Some ty2' -> Some ty2'
|
||||
(* Variable untyped *)
|
||||
| None, None -> None)
|
||||
s1
|
||||
s2
|
||||
in
|
||||
print_endline "wow!";
|
||||
merger
|
||||
;;
|
||||
|
||||
let to_string map =
|
||||
|
|
Reference in a new issue