comparison src/monoize.sml @ 846:0d30e6338c65

Some standard library reorgs and additions; handle mutual datatypes better in Specialize
author Adam Chlipala <adamc@hcoop.net>
date Tue, 09 Jun 2009 18:11:59 -0400
parents 74a1e3bdf430
children 0f7e2cca6d9b
comparison
equal deleted inserted replaced
845:6725d73c3c31 846:0d30e6338c65
776 (L'.TFun ((L'.TFfi ("Basis", "time"), loc), (L'.TFfi ("Basis", "bool"), loc)), loc), 776 (L'.TFun ((L'.TFfi ("Basis", "time"), loc), (L'.TFfi ("Basis", "bool"), loc)), loc),
777 (L'.EAbs ("y", (L'.TFfi ("Basis", "time"), loc), 777 (L'.EAbs ("y", (L'.TFfi ("Basis", "time"), loc),
778 (L'.TFfi ("Basis", "bool"), loc), 778 (L'.TFfi ("Basis", "bool"), loc),
779 (L'.EBinop ("==", (L'.ERel 1, loc), (L'.ERel 0, loc)), loc)), loc)), loc), 779 (L'.EBinop ("==", (L'.ERel 1, loc), (L'.ERel 0, loc)), loc)), loc)), loc),
780 fm) 780 fm)
781 | L.ECApp ((L.EFfi ("Basis", "eq_option"), _), t) =>
782 let
783 val t = monoType env t
784 val t' = (L'.TOption t, loc)
785 val bool = (L'.TFfi ("Basis", "bool"), loc)
786 in
787 ((L'.EAbs ("f", (L'.TFun (t, (L'.TFun (t, bool), loc)), loc),
788 (L'.TFun (t', (L'.TFun (t', bool), loc)), loc),
789 (L'.EAbs ("x", t', (L'.TFun (t', bool), loc),
790 (L'.EAbs ("y", t', bool,
791 (L'.ECase ((L'.ERecord [("1", (L'.ERel 1, loc), t'),
792 ("2", (L'.ERel 0, loc), t')], loc),
793 [((L'.PRecord [("1", (L'.PNone t, loc), t'),
794 ("2", (L'.PNone t, loc), t')], loc),
795 (L'.ECon (L'.Enum, L'.PConFfi {mod = "Basis",
796 datatyp = "bool",
797 con = "True",
798 arg = NONE},
799 NONE), loc)),
800 ((L'.PRecord [("1", (L'.PSome (t,
801 (L'.PVar ("x1",
802 t), loc)),
803 loc), t'),
804 ("2", (L'.PSome (t,
805 (L'.PVar ("x2",
806 t), loc)),
807 loc), t')], loc),
808 (L'.EApp ((L'.EApp ((L'.ERel 4, loc),
809 (L'.ERel 1, loc)), loc),
810 (L'.ERel 0, loc)), loc)),
811 ((L'.PWild, loc),
812 (L'.ECon (L'.Enum, L'.PConFfi {mod = "Basis",
813 datatyp = "bool",
814 con = "False",
815 arg = NONE},
816 NONE), loc))],
817 {disc = (L'.TRecord [("1", t'), ("2", t')], loc),
818 result = (L'.TFfi ("Basis", "bool"), loc)}),
819 loc)), loc)), loc)), loc),
820 fm)
821 end
822 781
823 | L.ECApp ((L.EFfi ("Basis", "mkEq"), _), t) => 782 | L.ECApp ((L.EFfi ("Basis", "mkEq"), _), t) =>
824 let 783 let
825 val t = monoType env t 784 val t = monoType env t
826 val b = (L'.TFfi ("Basis", "bool"), loc) 785 val b = (L'.TFfi ("Basis", "bool"), loc)