<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -24,14 +24,15 @@ app _ (_ :@ VPrim _) (_ :@ VLam _) = error &quot;Apply primitive to lambda not suppor
 app &#948; l r = &#948; :@ VApp l r
 
 subst :: (Value a) =&gt; Depth -&gt; Depth -&gt; Val a -&gt; Val a -&gt; Val a
-subst &#948;s shift&#948; arg (&#948;body :@ body)
-    | &#948;body &lt;= &#948;s = &#948;body :@ body
-    | VLam &#955;   &lt;- body = &#948;new :@ VLam (subst &#948;s shift&#948; arg &#955;)
-    | VApp l r &lt;- body = app &#948;new (subst &#948;s shift&#948; arg l) (subst &#948;s shift&#948; arg r)
-    | VVar     &lt;- body = if &#948;s+1 == &#948;body then arg else &#948;new :@ VVar
-    | VPrim v  &lt;- body = 0 :@ VPrim v
+subst &#948;s shift&#948; arg = go
     where
-    &#948;new = &#948;body + shift&#948;
+    go (&#948;body :@ body) | &#948;body &lt;= &#948;s = &#948;body :@ body
+    go (&#948;body :@ VLam &#955;)   = new&#948; &#948;body :@ VLam (go &#955;)
+    go (&#948;body :@ VApp l r) = app (new&#948; &#948;body) (go l) (go r)
+    go (&#948;body :@ VVar)     = if &#948;s+1 == &#948;body then arg else (new&#948; &#948;body) :@ VVar
+    go (_     :@ VPrim v)  = 0 :@ VPrim v
+
+    new&#948; &#948;body = &#948;body + shift&#948;
 
 minFree n (t :% u) = plusWith min (minFree n t) (minFree n u)
 minFree n (Lam t) = minFree (n+1) t</diff>
      <filename>experiments/interp-stack/InterpStack/DepthLazyNF.hs</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>1afc64051b44cc6b3e1918d8d27f1b9ced788f3a</id>
    </parent>
  </parents>
  <author>
    <name>Luke Palmer</name>
    <email>lrpalmer@gmail.com</email>
  </author>
  <url>http://github.com/luqui/dana/commit/4f4309262d414229ebb6dc1ee9d58fb0f4afbfaa</url>
  <id>4f4309262d414229ebb6dc1ee9d58fb0f4afbfaa</id>
  <committed-date>2009-07-05T23:11:27-07:00</committed-date>
  <authored-date>2009-07-05T23:11:27-07:00</authored-date>
  <message>Refactored subst function.</message>
  <tree>74847900bc1637a12a63aaba93b4dd844fdb684d</tree>
  <committer>
    <name>Luke Palmer</name>
    <email>lrpalmer@gmail.com</email>
  </committer>
</commit>
