The solver works ... well at least it compiles

This commit is contained in:
Mysaa 2024-03-14 13:27:12 +01:00
parent 35d0bd817e
commit 8f45228e1d
Signed by: Mysaa
GPG Key ID: 7054D5D6A90F084F

View File

@ -37,8 +37,9 @@ module Make (T : Utils.Functor) = struct
| NErr of 'e | NErr of 'e
| NDo of ('a, 'e) Constraint.t T.t | NDo of ('a, 'e) Constraint.t T.t
let eval : type a e. bool -> env -> (a, e) Constraint.t -> log * env * (a, e) normal_constraint let eval (type a e) ~log (env0 : env) (c0 : (a, e) Constraint.t)
= fun log env0 c0 -> : log * env * (a, e) normal_constraint
=
let add_to_log, get_log = let add_to_log, get_log =
if log then make_logger c0 if log then make_logger c0
else ignore, (fun _ -> []) else ignore, (fun _ -> [])
@ -90,14 +91,16 @@ module Make (T : Utils.Functor) = struct
env := a; env := a;
add_to_log (!env); add_to_log (!env);
NRet (fun _ -> ()) (* We return unit *) NRet (fun _ -> ()) (* We return unit *)
| Error(Clash(x,y)) -> NErr (Clash(x,y)) | Error(Clash(x,y)) ->
let xt,yt = Decode.decode (!env) x, Decode.decode (!env) y in
NErr(Clash(xt,yt))
| Error(Cycle(x)) -> NErr (Cycle(x)) | Error(Cycle(x)) -> NErr (Cycle(x))
end end
| Exist(x,s,c) -> | Exist(x,s,c) ->
env := Unif.Env.add x s !env; env := Unif.Env.add x s !env;
add_to_log (!env); add_to_log (!env);
evalc c evalc c
| Decode(v) -> _ | Decode(v) -> NRet (fun _ -> Decode.decode (!env) v)
| Do(act) -> NDo act | Do(act) -> NDo act
in in
let out = evalc c0 in let out = evalc c0 in