diff src/monoize.sml @ 741:f7e2026dd5ae

Returning a blob as page result
author Adam Chlipala <adamc@hcoop.net>
date Sun, 26 Apr 2009 09:02:17 -0400
parents d049d31a1966
children 2c7244c066f1
line wrap: on
line diff
--- a/src/monoize.sml	Sat Apr 25 14:47:16 2009 -0400
+++ b/src/monoize.sml	Sun Apr 26 09:02:17 2009 -0400
@@ -128,6 +128,7 @@
                     readType (mt env dtmap t, loc)
 
                   | L.CFfi ("Basis", "url") => (L'.TFfi ("Basis", "string"), loc)
+                  | L.CFfi ("Basis", "mimeType") => (L'.TFfi ("Basis", "string"), loc)
                   | L.CApp ((L.CApp ((L.CApp ((L.CFfi ("Basis", "xml"), _), _), _), _), _), _) =>
                     (L'.TFfi ("Basis", "string"), loc)
                   | L.CApp ((L.CApp ((L.CFfi ("Basis", "xhtml"), _), _), _), _) =>
@@ -2560,6 +2561,20 @@
                            (L'.EError ((L'.ERel 0, loc), t), loc)), loc),
                  fm)
             end
+          | L.ECApp ((L.EFfi ("Basis", "returnBlob"), _), t) =>
+            let
+                val t = monoType env t
+                val un = (L'.TRecord [], loc)
+            in
+                ((L'.EAbs ("b", (L'.TFfi ("Basis", "blob"), loc),
+                           (L'.TFun ((L'.TFfi ("Basis", "string"), loc), (L'.TFun (un, t), loc)), loc),
+                           (L'.EAbs ("mt", (L'.TFfi ("Basis", "string"), loc), (L'.TFun (un, t), loc),
+                                     (L'.EAbs ("_", un, t,
+                                               (L'.EReturnBlob {blob = (L'.ERel 2, loc),
+                                                                mimeType = (L'.ERel 1, loc),
+                                                                t = t}, loc)), loc)), loc)), loc),
+                 fm)
+            end
 
           | L.EApp (e1, e2) =>
             let