diff src/monoize.sml @ 670:f73913d97a40

Proper recv
author Adam Chlipala <adamc@hcoop.net>
date Sun, 22 Mar 2009 16:03:45 -0400
parents b0c1a46b1f15
children e0c186464612
line wrap: on
line diff
--- a/src/monoize.sml	Sun Mar 22 15:16:34 2009 -0400
+++ b/src/monoize.sml	Sun Mar 22 16:03:45 2009 -0400
@@ -979,6 +979,24 @@
                                                           loc)), loc)), loc)), loc)), loc),
                  fm)
             end
+          | L.EApp ((L.EApp ((L.ECApp ((L.ECApp ((L.ECApp ((L.EFfi ("Basis", "bind"), _), _), _), _), _), t2), _),
+                             (L.EFfi ("Basis", "transaction_monad"), _)), _),
+                    (L.EApp ((L.ECApp ((L.EFfi ("Basis", "recv"), _), t1), _),
+                             ch), loc)) =>
+            let
+                val t1 = monoType env t1
+                val t2 = monoType env t2
+                val un = (L'.TRecord [], loc)
+                val mt2 = (L'.TFun (un, t2), loc)
+                val (ch, fm) = monoExp (env, st, fm) ch
+            in
+                ((L'.EAbs ("m2", (L'.TFun (t1, mt2), loc), (L'.TFun (un, un), loc),
+                           (L'.EAbs ("_", un, un,
+                                     (L'.ERecv (liftExpInExp 0 (liftExpInExp 0 ch),
+                                                (L'.ERel 1, loc),
+                                                t1), loc)), loc)), loc),
+                 fm)
+            end
 
           | L.ECApp ((L.EFfi ("Basis", "source"), _), t) =>
             let