diff src/corify.sml @ 125:fd98dd10dce7

Corifying (non-mutual) 'val rec'
author Adam Chlipala <adamc@hcoop.net>
date Thu, 17 Jul 2008 10:23:04 -0400
parents 541282b81454
children 96bd3350e77d
line wrap: on
line diff
--- a/src/corify.sml	Thu Jul 17 10:13:18 2008 -0400
+++ b/src/corify.sml	Thu Jul 17 10:23:04 2008 -0400
@@ -384,8 +384,24 @@
         in
             ([(L'.DVal (x, n, corifyCon st t, corifyExp st e, s), loc)], st)
         end
-      | L.DValRec _ => raise Fail "Explify DValRec"
-                                                                        
+      | L.DValRec vis =>
+        let
+            val (vis, st) = ListUtil.foldlMap
+                            (fn ((x, n, t, e), st) =>
+                                let
+                                    val (st, n) = St.bindVal st x n
+                                    val s =
+                                        if String.isPrefix "wrap_" x then
+                                            String.extract (x, 5, NONE)
+                                        else
+                                            x
+                                in
+                                    ((x, n, corifyCon st t, corifyExp st e, s), st)
+                                end)
+                            st vis
+        in
+            ([(L'.DValRec vis, loc)], st)
+        end
       | L.DSgn _ => ([], st)
 
       | L.DStr (x, n, _, (L.StrFun (_, na, _, _, str), _)) =>