diff src/monoize.sml @ 754:8688e01ae469

A view query works
author Adam Chlipala <adamc@hcoop.net>
date Tue, 28 Apr 2009 15:04:37 -0400
parents d484df4e841a
children 8ce31c052dce
line wrap: on
line diff
--- a/src/monoize.sml	Tue Apr 28 14:02:23 2009 -0400
+++ b/src/monoize.sml	Tue Apr 28 15:04:37 2009 -0400
@@ -2938,6 +2938,24 @@
                        (L'.DVal (x, n, t', e_name, s), loc)])
             end
           | L.DTable _ => poly ()
+          | L.DView (x, n, s, e, (L.CRecord (_, xts), _)) =>
+            let
+                val t = (L.CFfi ("Basis", "string"), loc)
+                val t' = (L'.TFfi ("Basis", "string"), loc)
+                val s = "uw_" ^ s
+                val e_name = (L'.EPrim (Prim.String s), loc)
+
+                val xts = map (fn (x, t) => (monoName env x, monoType env t)) xts
+
+                val (e, fm) = monoExp (env, St.empty, fm) e
+                val e = (L'.EFfiApp ("Basis", "viewify", [e]), loc)
+            in
+                SOME (Env.pushENamed env x n t NONE s,
+                      fm,
+                      [(L'.DView (s, xts, e), loc),
+                       (L'.DVal (x, n, t', e_name, s), loc)])
+            end
+          | L.DView _ => poly ()
           | L.DSequence (x, n, s) =>
             let
                 val t = (L.CFfi ("Basis", "string"), loc)