comparison src/monoize.sml @ 286:ffe5b01908ae

'show' type class; htmlification optimizations
author Adam Chlipala <adamc@hcoop.net>
date Sun, 07 Sep 2008 10:48:51 -0400
parents c0e4ac23522d
children 4260ad920c36
comparison
equal deleted inserted replaced
285:e89076c41c39 286:ffe5b01908ae
78 | L.TCFun _ => poly () 78 | L.TCFun _ => poly ()
79 | L.TRecord (L.CRecord ((L.KType, _), xcs), _) => 79 | L.TRecord (L.CRecord ((L.KType, _), xcs), _) =>
80 (L'.TRecord (map (fn (x, t) => (monoName env x, mt env dtmap t)) xcs), loc) 80 (L'.TRecord (map (fn (x, t) => (monoName env x, mt env dtmap t)) xcs), loc)
81 | L.TRecord _ => poly () 81 | L.TRecord _ => poly ()
82 82
83 | L.CApp ((L.CFfi ("Basis", "show"), _), t) =>
84 (L'.TFun (mt env dtmap t, (L'.TFfi ("Basis", "string"), loc)), loc)
85
83 | L.CApp ((L.CApp ((L.CApp ((L.CFfi ("Basis", "xml"), _), _), _), _), _), _) => 86 | L.CApp ((L.CApp ((L.CApp ((L.CFfi ("Basis", "xml"), _), _), _), _), _), _) =>
84 (L'.TFfi ("Basis", "string"), loc) 87 (L'.TFfi ("Basis", "string"), loc)
85 | L.CApp ((L.CApp ((L.CFfi ("Basis", "xhtml"), _), _), _), _) => 88 | L.CApp ((L.CApp ((L.CFfi ("Basis", "xhtml"), _), _), _), _) =>
86 (L'.TFfi ("Basis", "string"), loc) 89 (L'.TFfi ("Basis", "string"), loc)
87 90
458 end 461 end
459 in 462 in
460 ((L'.ECon (dk, monoPatCon env pc, eo), loc), fm) 463 ((L'.ECon (dk, monoPatCon env pc, eo), loc), fm)
461 end 464 end
462 | L.ECon _ => poly () 465 | L.ECon _ => poly ()
466
467 | L.ECApp ((L.EFfi ("Basis", "show"), _), t) =>
468 let
469 val t = monoType env t
470 val s = (L'.TFfi ("Basis", "string"), loc)
471 in
472 ((L'.EAbs ("f", (L'.TFun (t, s), loc), (L'.TFun (t, s), loc),
473 (L'.ERel 0, loc)), loc), fm)
474 end
475 | L.EFfi ("Basis", "show_int") =>
476 ((L'.EFfi ("Basis", "intToString"), loc), fm)
477 | L.EFfi ("Basis", "show_float") =>
478 ((L'.EFfi ("Basis", "floatToString"), loc), fm)
479 | L.EFfi ("Basis", "show_string") =>
480 let
481 val s = (L'.TFfi ("Basis", "string"), loc)
482 in
483 ((L'.EAbs ("s", s, s, (L'.ERel 0, loc)), loc), fm)
484 end
485 | L.EFfi ("Basis", "show_bool") =>
486 ((L'.EFfi ("Basis", "boolToString"), loc), fm)
463 487
464 | L.ECApp ((L.EFfi ("Basis", "return"), _), t) => 488 | L.ECApp ((L.EFfi ("Basis", "return"), _), t) =>
465 let 489 let
466 val t = monoType env t 490 val t = monoType env t
467 in 491 in