518518
519519module Elpi = struct
520520
521- type t = ED .uvar_body
521+ type t = ED .uvar
522522
523523 let pp = Compiler. pp_uvar_body
524524 let show m = Format. asprintf " %a" pp m
@@ -535,7 +535,7 @@ module Elpi = struct
535535
536536 let alloc_Elpi name state =
537537 let module R = (val ! r) in
538- state, (ED. oref ED. dummy)
538+ state, (ED. oref ~depth: 0 ED. dummy)
539539
540540 let make ?name state =
541541 match name with
@@ -577,11 +577,11 @@ module RawData = struct
577577 let module R = (val ! r) in let open R in
578578 match deref_head ~depth t with
579579 | ED.Term. Arg _ | ED.Term. AppArg _ -> assert false
580- | ED.Term. AppUVar (ub ,0 , args ) -> UnifVar (ub,args)
581- | ED.Term. AppUVar (ub ,lvl , args ) -> look ~depth (R. expand_appuv ub ~depth ~lvl ~args )
582- | ED.Term. UVar (ub ,lvl , ano ) -> look ~depth (R. expand_uv ub ~depth ~lvl ~ano )
580+ | ED.Term. AppUVar (ub ,args ) when ub.vardepth == 0 -> UnifVar (ub,args)
581+ | ED.Term. AppUVar (ub ,args ) -> look ~depth (R. expand_appuv ub ~depth ~args )
582+ | ED.Term. UVar (ub ,ano ) -> look ~depth (R. expand_uv ub ~depth ~ano )
583583 | ED.Term. Discard ->
584- let ub = ED. oref ED. dummy in
584+ let ub = ED. oref ~depth: 0 ED. dummy in
585585 UnifVar (ub,R. mkinterval 0 depth 0 )
586586 | ED.Term. Lam _ as t ->
587587 begin match R. eta_contract_flex ~depth t with
@@ -591,7 +591,7 @@ module RawData = struct
591591 | x -> Obj. magic x (* HACK: view is a "subtype" of Term.term *)
592592
593593 let kool = function
594- | UnifVar (ub ,args ) -> ED.Term. AppUVar (ub,0 , args)
594+ | UnifVar (ub ,args ) -> ED.Term. AppUVar (ub,args)
595595 | x -> Obj. magic x
596596 [@@ inline]
597597
@@ -680,7 +680,8 @@ module RawData = struct
680680 let no_constraints = []
681681
682682 let mkUnifVar ub ~args state =
683- ED.Term. mkAppUVar ub 0 args
683+ if args = [] then ED.Term. mkUVar ub 0
684+ else ED.Term. mkAppUVar ub args
684685
685686 type Conversion.extra_goal + =
686687 | RawGoal = ED.Conversion .RawGoal
@@ -905,7 +906,7 @@ module BuiltInPredicate = struct
905906
906907 let beta ~depth t args =
907908 let module R = (val ! r) in let open R in
908- deref_appuv ~from: depth ~to_: depth ?avoid:None args t
909+ deref_apparg ~from: depth ~to_: depth ?avoid:None t args
909910
910911 module HOAdaptors = struct
911912
@@ -915,7 +916,7 @@ module BuiltInPredicate = struct
915916 type ('a,'b,'c) pred3 = Data .term * 'a Conversion .t * 'b Conversion .t * 'c Conversion .t
916917 type ('a,'b) pred3a = Data .term * 'a Conversion .t * 'b Conversion .t
917918
918- let pred1_ty x = Conversion. TyApp (" ->" ,x.Conversion. ty,[Conversion. TyName " prop " ])
919+ let pred1_ty x = Conversion. TyApp (" ->" ,x.Conversion. ty,[Conversion. TyName " (func) " ])
919920 let pred1 x = { Conversion. ty = pred1_ty x; readback = (fun ~depth state e -> state,(e,x),[] ); embed = (fun ~depth state (x ,_ ) -> state,x,[] ); pp = (fun fmt (x ,_ ) -> Format. fprintf fmt " <pred1>" ); pp_doc = (fun fmt () -> () ) }
920921 let pred2_ty x y = Conversion. (TyApp (" ->" ,x.Conversion. ty,[TyApp (" ->" ,y.Conversion. ty,[Conversion. TyName " prop" ])]))
921922 let pred2 x y = { Conversion. ty = pred2_ty x y; readback = (fun ~depth state e -> state,(e,x,y),[] ); embed = (fun ~depth state (x ,_ ,_ ) -> state,x,[] ); pp = (fun fmt (x ,_ ,_ ) -> Format. fprintf fmt " <pred2>" ); pp_doc = (fun fmt () -> () ) }
0 commit comments