217 fun flexflex2(env,binders,F,Fty,is,G,Gty,js) = |
217 fun flexflex2(env,binders,F,Fty,is,G,Gty,js) = |
218 let fun ff(F,Fty,is,G as (a,_),Gty,js) = |
218 let fun ff(F,Fty,is,G as (a,_),Gty,js) = |
219 if subset (op =) (js, is) |
219 if subset (op =) (js, is) |
220 then let val t= mkabs(binders,is,app(Var(G,Gty),map (idx is) js)) |
220 then let val t= mkabs(binders,is,app(Var(G,Gty),map (idx is) js)) |
221 in Envir.update (((F, Fty), t), env) end |
221 in Envir.update (((F, Fty), t), env) end |
222 else let val ks = inter (op =) (is, js) |
222 else let val ks = inter (op =) js is |
223 val Hty = type_of_G env (Fty,length is,map (idx is) ks) |
223 val Hty = type_of_G env (Fty,length is,map (idx is) ks) |
224 val (env',H) = Envir.genvar a (env,Hty) |
224 val (env',H) = Envir.genvar a (env,Hty) |
225 fun lam(is) = mkabs(binders,is,app(H,map (idx is) ks)); |
225 fun lam(is) = mkabs(binders,is,app(H,map (idx is) ks)); |
226 in Envir.update (((G, Gty), lam js), Envir.update (((F, Fty), lam is), env')) |
226 in Envir.update (((G, Gty), lam js), Envir.update (((F, Fty), lam is), env')) |
227 end; |
227 end; |