changeset 68:c1e21ab42896

Explify cfold
author Adam Chlipala <adamc@hcoop.net>
date Thu, 26 Jun 2008 09:51:28 -0400
parents 9f89f0b00b84
children 8e9920db39f2
files src/corify.sml src/expl.sml src/expl_print.sml src/expl_util.sml src/explify.sml
diffstat 5 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/corify.sml	Thu Jun 26 09:48:54 2008 -0400
+++ b/src/corify.sml	Thu Jun 26 09:51:28 2008 -0400
@@ -244,6 +244,7 @@
       | L.CRecord (k, xcs) =>
         (L'.CRecord (corifyKind k, map (fn (c1, c2) => (corifyCon st c1, corifyCon st c2)) xcs), loc)
       | L.CConcat (c1, c2) => (L'.CConcat (corifyCon st c1, corifyCon st c2), loc)
+      | L.CFold _ => raise Fail "Corify CFold"
 
 fun corifyExp st (e, loc) =
     case e of
--- a/src/expl.sml	Thu Jun 26 09:48:54 2008 -0400
+++ b/src/expl.sml	Thu Jun 26 09:51:28 2008 -0400
@@ -52,6 +52,7 @@
 
        | CRecord of kind * (con * con) list
        | CConcat of con * con
+       | CFold of kind * kind
 
 withtype con = con' located
 
--- a/src/expl_print.sml	Thu Jun 26 09:48:54 2008 -0400
+++ b/src/expl_print.sml	Thu Jun 26 09:51:28 2008 -0400
@@ -143,6 +143,7 @@
                                               string "++",
                                               space,
                                               p_con env c2])
+      | CFold _ => string "fold"
         
 and p_con env = p_con' false env
 
--- a/src/expl_util.sml	Thu Jun 26 09:48:54 2008 -0400
+++ b/src/expl_util.sml	Thu Jun 26 09:51:28 2008 -0400
@@ -138,6 +138,12 @@
                          S.map2 (mfc ctx c2,
                               fn c2' =>
                                  (CConcat (c1', c2'), loc)))
+              | CFold (k1, k2) =>
+                S.bind2 (mfk k1,
+                         fn k1' =>
+                            S.map2 (mfk k2,
+                                    fn k2' =>
+                                       (CFold (k1', k2'), loc)))
     in
         mfc
     end
--- a/src/explify.sml	Thu Jun 26 09:48:54 2008 -0400
+++ b/src/explify.sml	Thu Jun 26 09:51:28 2008 -0400
@@ -59,7 +59,7 @@
 
       | L.CRecord (k, xcs) => (L'.CRecord (explifyKind k, map (fn (c1, c2) => (explifyCon c1, explifyCon c2)) xcs), loc)
       | L.CConcat (c1, c2) => (L'.CConcat (explifyCon c1, explifyCon c2), loc)
-      | L.CFold _ => raise Fail "Explify CFold"
+      | L.CFold (dom, ran) => (L'.CFold (explifyKind dom, explifyKind ran), loc)
 
       | L.CError => raise Fail ("explifyCon: CError at " ^ EM.spanToString loc)
       | L.CUnif (_, _, ref (SOME c)) => explifyCon c