changeset 818:066493f7f008

Change List.mapM' to avoid leaving functions around
author Adam Chlipala <adamc@hcoop.net>
date Thu, 21 May 2009 11:45:04 -0400
parents 4585f744574a
children cb30dd2ba353
files lib/ur/list.ur src/especialize.sml src/monoize.sml
diffstat 3 files changed, 12 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/lib/ur/list.ur	Thu May 21 10:34:56 2009 -0400
+++ b/lib/ur/list.ur	Thu May 21 11:45:04 2009 -0400
@@ -44,8 +44,8 @@
     let
         fun mapM' acc ls =
             case ls of
-                [] => acc
-              | x :: ls => mapM' (x' <- f x; ls' <- acc; return (x' :: ls')) ls
+                [] => return (rev acc)
+              | x :: ls => x' <- f x; mapM' (x' :: acc) ls
     in
-        mapM' (return [])
+        mapM' []
     end
--- a/src/especialize.sml	Thu May 21 10:34:56 2009 -0400
+++ b/src/especialize.sml	Thu May 21 11:45:04 2009 -0400
@@ -205,7 +205,10 @@
                                                        [("e'", CorePrint.p_exp CoreEnv.empty e)];*)
                                         (#1 e, st)
                                     end
-                                  | (_, true) => (e, st)
+                                  | (_, true) => ((*Print.prefaces ("No(" ^ name ^ ")")
+                                                                 [("fxs'",
+                                                                   Print.p_list (CorePrint.p_exp CoreEnv.empty) fxs')];*)
+                                                  (e, st))
                                   | (NONE, false) =>
                                     let
                                         (*val () = Print.prefaces "New one"
@@ -213,6 +216,10 @@
                                                   ("mns", Print.p_list Print.PD.string
                                                                        (SS.listItems (!mayNotSpec)))]*)
 
+                                        (*val () = Print.prefaces ("Yes(" ^ name ^ ")")
+                                                                [("fxs'",
+                                                                  Print.p_list (CorePrint.p_exp CoreEnv.empty) fxs')]*)
+
                                         fun subBody (body, typ, fxs') =
                                             case (#1 body, #1 typ, fxs') of
                                                 (_, _, []) => SOME (body, typ)
--- a/src/monoize.sml	Thu May 21 10:34:56 2009 -0400
+++ b/src/monoize.sml	Thu May 21 11:45:04 2009 -0400
@@ -2538,9 +2538,7 @@
 
                   | "dyn" =>
                     (case attrs of
-                         (*[("Signal", (L'.EApp ((L'.EAbs (_, _, _, (L'.ESignalReturn (L'.ERel 0, _), _)), _),
-                                               e), _), _)] => (e, fm)
-                       |*) [("Signal", e, _)] =>
+                         [("Signal", e, _)] =>
                          ((L'.EStrcat
                                ((L'.EPrim (Prim.String "<span><script type=\"text/javascript\">dyn("), loc),
                                 (L'.EStrcat ((L'.EJavaScript (L'.Script, e), loc),