changeset 330:f307cdd08d81

Remove unneeded 'rec' in Reduce
author Adam Chlipala <adamc@hcoop.net>
date Sat, 13 Sep 2008 10:33:30 -0400
parents eec65c11d3e2
children 41458a694575
files lib/top.ur src/reduce.sml
diffstat 2 files changed, 18 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/lib/top.ur	Sat Sep 13 10:30:45 2008 -0400
+++ b/lib/top.ur	Sat Sep 13 10:33:30 2008 -0400
@@ -8,7 +8,7 @@
 
 fun txt (t ::: Type) (ctx ::: {Unit}) (use ::: {Type}) (sh : show t) (v : t) = cdata (show sh v)
 
-val foldTR2 (tf1 :: Type -> Type) (tf2 :: Type -> Type) (tr :: {Type} -> Type)
+fun foldTR2 (tf1 :: Type -> Type) (tf2 :: Type -> Type) (tr :: {Type} -> Type)
         (f : nm :: Name -> t :: Type -> rest :: {Type} -> [nm] ~ rest
                 -> tf1 t -> tf2 t -> tr rest -> tr ([nm = t] ++ rest))
         (i : tr []) =
--- a/src/reduce.sml	Sat Sep 13 10:30:45 2008 -0400
+++ b/src/reduce.sml	Sat Sep 13 10:33:30 2008 -0400
@@ -148,7 +148,23 @@
 
 and reduceExp env = U.Exp.mapB {kind = kind, con = con, exp = exp, bind = bind} env
 
-fun decl env d = d
+fun decl env d =
+    case d of
+        DValRec [vi as (_, n, _, e, _)] =>
+        let
+            fun kind _ = false
+            fun con _ = false
+            fun exp e =
+                case e of
+                    ENamed n' => n' = n
+                  | _ => false
+        in
+            if U.Exp.exists {kind = kind, con = con, exp = exp} e then
+                d
+            else
+                DVal vi
+        end
+      | _ => d
 
 val reduce = U.File.mapB {kind = kind, con = con, exp = exp, decl = decl, bind = bind} E.empty