356 |
fun select ((tvar,tkind),tyc) = (tvar,tyc) |
fun select ((tvar,tkind),tyc) = (tvar,tyc) |
357 |
val tvtcs = ListPair.map select (tvks, ts) |
val tvtcs = ListPair.map select (tvks, ts) |
358 |
fun cmp ((tvar1,_), (tvar2,_)) = tvar1 > tvar2 |
fun cmp ((tvar1,_), (tvar2,_)) = tvar1 > tvar2 |
359 |
val tvtcs = Sort.sort cmp tvtcs |
val tvtcs = ListMergeSort.sort cmp tvtcs |
360 |
in |
in |
361 |
mergesmaps (tvtcs, smap) |
mergesmaps (tvtcs, smap) |
362 |
end |
end |
363 |
(***** end of the substitution intmapf hack *********************) |
(***** end of the substitution intmapf hack *********************) |
364 |
|
|
365 |
(***** the nvar-depth intmapf: named variable -> DI.depth *********) |
(***** the nvar-depth intmapf: named variable -> DI.depth *********) |
366 |
type nmap = DI.depth IntmapF.intmap |
type nmap = DI.depth IntBinaryMap.map |
367 |
val initnmap = IntmapF.empty |
val initnmap = IntBinaryMap.empty |
368 |
fun addnmap (tvks, d, nmap) = |
fun addnmap (tvks, d, nmap) = |
369 |
let fun h ((tv,_)::xs, nmap) = |
let fun h ((tv,_)::xs, nmap) = |
370 |
h(xs, IntmapF.add(nmap, tv, d)) |
h(xs, IntBinaryMap.insert(nmap, tv, d)) |
371 |
| h ([], nmap) = nmap |
| h ([], nmap) = nmap |
372 |
in h(tvks, nmap) |
in h(tvks, nmap) |
373 |
end |
end |
374 |
fun looknmap nmap nvar = |
fun looknmap nmap nvar = |
375 |
((IntmapF.lookup nmap nvar) handle IntmapF.IntmapF => |
case IntBinaryMap.find(nmap, nvar) of SOME d => d | NONE => DI.top |
376 |
bug "unexpected case in looknmap") |
(* bug "unexpected case in looknmap") *) |
377 |
(***** end of the substitution intmapf hack *********************) |
(***** end of the substitution intmapf hack *********************) |
378 |
|
|
379 |
fun phase x = Stats.doPhase (Stats.makePhase x) |
fun phase x = Stats.doPhase (Stats.makePhase x) |