Mercurial > urweb
comparison src/especialize.sml @ 522:3162bbf8e30f
Avoid Especializing polymorphic code
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Thu, 27 Nov 2008 12:43:28 -0500 |
parents | 31aba58a5b5b |
children | 230654093b51 |
comparison
equal
deleted
inserted
replaced
521:31aba58a5b5b | 522:3162bbf8e30f |
---|---|
56 bind = fn (bound, b) => | 56 bind = fn (bound, b) => |
57 case b of | 57 case b of |
58 U.Exp.RelE _ => bound + 1 | 58 U.Exp.RelE _ => bound + 1 |
59 | _ => bound} | 59 | _ => bound} |
60 0 IS.empty | 60 0 IS.empty |
61 | |
62 val isPoly = U.Decl.exists {kind = fn _ => false, | |
63 con = fn _ => false, | |
64 exp = fn ECAbs _ => true | |
65 | _ => false, | |
66 decl = fn _ => false} | |
61 | 67 |
62 fun positionOf (v : int, ls) = | 68 fun positionOf (v : int, ls) = |
63 let | 69 let |
64 fun pof (pos, ls) = | 70 fun pof (pos, ls) = |
65 case ls of | 71 case ls of |
300 funcs = funcs, | 306 funcs = funcs, |
301 decls = []} | 307 decls = []} |
302 | 308 |
303 (*val () = Print.prefaces "decl" [("d", CorePrint.p_decl CoreEnv.empty d)]*) | 309 (*val () = Print.prefaces "decl" [("d", CorePrint.p_decl CoreEnv.empty d)]*) |
304 | 310 |
305 val (d', st) = specDecl [] st d | 311 val (d', st) = |
312 if isPoly d then | |
313 (d, st) | |
314 else | |
315 specDecl [] st d | |
306 | 316 |
307 (*val () = print "/decl\n"*) | 317 (*val () = print "/decl\n"*) |
308 | 318 |
309 val funcs = #funcs st | 319 val funcs = #funcs st |
310 val funcs = | 320 val funcs = |