diff src/monoize.sml @ 844:74a1e3bdf430

Fix datatype import bug in Elaborate; fix server-side source setting; more standard library stuff
author Adam Chlipala <adamc@hcoop.net>
date Sun, 07 Jun 2009 16:45:00 -0400
parents 44c2c089ca15
children 0d30e6338c65
line wrap: on
line diff
--- a/src/monoize.sml	Sun Jun 07 14:15:22 2009 -0400
+++ b/src/monoize.sml	Sun Jun 07 16:45:00 2009 -0400
@@ -778,6 +778,48 @@
                                  (L'.TFfi ("Basis", "bool"), loc),
                                  (L'.EBinop ("==", (L'.ERel 1, loc), (L'.ERel 0, loc)), loc)), loc)), loc),
              fm)
+          | L.ECApp ((L.EFfi ("Basis", "eq_option"), _), t) =>
+            let
+                val t = monoType env t
+                val t' = (L'.TOption t, loc)
+                val bool = (L'.TFfi ("Basis", "bool"), loc)
+            in
+                ((L'.EAbs ("f", (L'.TFun (t, (L'.TFun (t, bool), loc)), loc),
+                           (L'.TFun (t', (L'.TFun (t', bool), loc)), loc),
+                           (L'.EAbs ("x", t', (L'.TFun (t', bool), loc),
+                                     (L'.EAbs ("y", t', bool,
+                                               (L'.ECase ((L'.ERecord [("1", (L'.ERel 1, loc), t'),
+                                                                       ("2", (L'.ERel 0, loc), t')], loc),
+                                                          [((L'.PRecord [("1", (L'.PNone t, loc), t'),
+                                                                         ("2", (L'.PNone t, loc), t')], loc),
+                                                            (L'.ECon (L'.Enum, L'.PConFfi {mod = "Basis",
+                                                                                           datatyp = "bool",
+                                                                                           con = "True",
+                                                                                           arg = NONE},
+                                                                      NONE), loc)),
+                                                           ((L'.PRecord [("1", (L'.PSome (t,
+                                                                                          (L'.PVar ("x1",
+                                                                                                    t), loc)),
+                                                                                loc), t'),
+                                                                         ("2", (L'.PSome (t,
+                                                                                          (L'.PVar ("x2",
+                                                                                                    t), loc)),
+                                                                                loc), t')], loc),
+                                                            (L'.EApp ((L'.EApp ((L'.ERel 4, loc),
+                                                                                (L'.ERel 1, loc)), loc),
+                                                                      (L'.ERel 0, loc)), loc)),
+                                                           ((L'.PWild, loc),
+                                                            (L'.ECon (L'.Enum, L'.PConFfi {mod = "Basis",
+                                                                                           datatyp = "bool",
+                                                                                           con = "False",
+                                                                                           arg = NONE},
+                                                                      NONE), loc))],
+                                                          {disc = (L'.TRecord [("1", t'), ("2", t')], loc),
+                                                           result = (L'.TFfi ("Basis", "bool"), loc)}),
+                                                loc)), loc)), loc)), loc),
+                 fm)
+            end
+
           | L.ECApp ((L.EFfi ("Basis", "mkEq"), _), t) =>
             let
                 val t = monoType env t