147 |
| lpcon (DATAcon _) = bug "unexpected case in lpcon" |
| lpcon (DATAcon _) = bug "unexpected case in lpcon" |
148 |
| lpcon c = (c, ident) |
| lpcon c = (c, ident) |
149 |
|
|
|
(* lpev : lexp -> (value * (lexp -> lexp)) *) |
|
|
and lpev (RET [v]) = (v, ident) |
|
|
| lpev e = (* bug "lpev not implemented yet" *) |
|
|
let val x= mkv() |
|
|
in (VAR x, fn y => LET([x], e, y)) |
|
|
end |
|
|
|
|
150 |
(* loop: lexp -> lexp *) |
(* loop: lexp -> lexp *) |
151 |
and loop le = |
and loop le = |
152 |
(case le |
(case le |
162 |
in hdr(ne1, loop e2) |
in hdr(ne1, loop e2) |
163 |
end |
end |
164 |
| TAPP(v, ts) => |
| TAPP(v, ts) => |
165 |
let val (u, hdr) = lpev(LP.tsLexp(kenv, ts)) |
let val (us, hdr) = LP.tsLexp(kenv, ts) |
166 |
|
|
167 |
(* a temporary hack that fixes type mismatches *) |
(* a temporary hack that fixes type mismatches *) |
168 |
val lt = getlty v |
val lt = getlty v |
169 |
val oldts = map ltf (#2 (LT.ltd_poly lt)) |
val oldts = map ltf (#2 (LT.ltd_poly lt)) |
170 |
val newts = map ltf (LT.lt_inst(lt, ts)) |
val newts = map ltf (LT.lt_inst(lt, ts)) |
171 |
val nhdr = mcast(oldts, newts) |
val nhdr = mcast(oldts, newts) |
172 |
in nhdr (hdr (APP(v, [u]))) |
in nhdr (hdr (APP(v, us))) |
173 |
end |
end |
174 |
|
|
175 |
| RECORD(RK_VECTOR tc, vs, v, e) => |
| RECORD(RK_VECTOR tc, vs, v, e) => |