changeset 70:2e0f3b21fb85

Cjrize cfold
author Adam Chlipala <adamc@hcoop.net>
date Thu, 26 Jun 2008 10:02:34 -0400
parents 8e9920db39f2
children 6431b315a1e3
files src/reduce.sml tests/cfold.lac
diffstat 2 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/reduce.sml	Thu Jun 26 09:53:52 2008 -0400
+++ b/src/reduce.sml	Thu Jun 26 10:02:34 2008 -0400
@@ -121,7 +121,14 @@
 
 fun con env c =
     case c of
-        CApp ((CAbs (_, _, c1), loc), c2) =>
+        CApp ((CApp ((CApp ((CFold ks, _), f), _), i), loc), (CRecord (k, xcs), _)) =>
+        (case xcs of
+             [] => #1 i
+           | (n, v) :: rest =>
+             #1 (reduceCon env (CApp ((CApp ((CApp (f, n), loc), v), loc),
+                                      (CApp ((CApp ((CApp ((CFold ks, loc), f), loc), i), loc),
+                                             (CRecord (k, rest), loc)), loc)), loc)))
+      | CApp ((CAbs (_, _, c1), loc), c2) =>
         #1 (reduceCon env (subConInCon (0, c2) c1))
       | CNamed n =>
         (case E.lookupCNamed env n of
--- a/tests/cfold.lac	Thu Jun 26 09:53:52 2008 -0400
+++ b/tests/cfold.lac	Thu Jun 26 10:02:34 2008 -0400
@@ -8,3 +8,5 @@
 
 con yellowCurry = currier [A = string, B = int, C = float]
 val yellowCurry : yellowCurry = fn x => fn y => fn z => {}
+
+val main = yellowCurry