summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2008-06-26 09:51:28 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2008-06-26 09:51:28 -0400
commitcb4c86447a24577e18fc312b77f23241962e09bc (patch)
treeb2a56cdbf16c73b3ecccf9f0e70ba9d1de0cfd01
parentbef69954307005832dca731aff9a7b008c88c8d8 (diff)
Explify cfold
-rw-r--r--src/corify.sml1
-rw-r--r--src/expl.sml1
-rw-r--r--src/expl_print.sml1
-rw-r--r--src/expl_util.sml6
-rw-r--r--src/explify.sml2
5 files changed, 10 insertions, 1 deletions
diff --git a/src/corify.sml b/src/corify.sml
index 4046a02a..b4a7108e 100644
--- a/src/corify.sml
+++ b/src/corify.sml
@@ -244,6 +244,7 @@ fun corifyCon st (c, loc) =
| 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
diff --git a/src/expl.sml b/src/expl.sml
index 8e9bdfed..952dc5da 100644
--- a/src/expl.sml
+++ b/src/expl.sml
@@ -52,6 +52,7 @@ datatype con' =
| CRecord of kind * (con * con) list
| CConcat of con * con
+ | CFold of kind * kind
withtype con = con' located
diff --git a/src/expl_print.sml b/src/expl_print.sml
index aca89834..445a0fff 100644
--- a/src/expl_print.sml
+++ b/src/expl_print.sml
@@ -143,6 +143,7 @@ fun p_con' par env (c, _) =
string "++",
space,
p_con env c2])
+ | CFold _ => string "fold"
and p_con env = p_con' false env
diff --git a/src/expl_util.sml b/src/expl_util.sml
index 23329f3e..809bc1e1 100644
--- a/src/expl_util.sml
+++ b/src/expl_util.sml
@@ -138,6 +138,12 @@ fun mapfoldB {kind = fk, con = fc, bind} =
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
diff --git a/src/explify.sml b/src/explify.sml
index 79e3b07f..0a84c5fe 100644
--- a/src/explify.sml
+++ b/src/explify.sml
@@ -59,7 +59,7 @@ fun explifyCon (c, loc) =
| 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