diff options
author | Adam Chlipala <adamc@hcoop.net> | 2008-06-26 09:53:52 -0400 |
---|---|---|
committer | Adam Chlipala <adamc@hcoop.net> | 2008-06-26 09:53:52 -0400 |
commit | f362668549c8db401474c7be1e15cd9e156d0e91 (patch) | |
tree | bace6e5d2be74b5fe6ba95d5553f0ebe266932df /src | |
parent | cb4c86447a24577e18fc312b77f23241962e09bc (diff) |
Corify cfold
Diffstat (limited to 'src')
-rw-r--r-- | src/core.sml | 1 | ||||
-rw-r--r-- | src/core_print.sml | 1 | ||||
-rw-r--r-- | src/core_util.sml | 6 | ||||
-rw-r--r-- | src/corify.sml | 2 | ||||
-rw-r--r-- | src/monoize.sml | 1 |
5 files changed, 10 insertions, 1 deletions
diff --git a/src/core.sml b/src/core.sml index 613e0c41..07ab4641 100644 --- a/src/core.sml +++ b/src/core.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/core_print.sml b/src/core_print.sml index a3fde909..7242e720 100644 --- a/src/core_print.sml +++ b/src/core_print.sml @@ -134,6 +134,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/core_util.sml b/src/core_util.sml index b3e266af..66918863 100644 --- a/src/core_util.sml +++ b/src/core_util.sml @@ -143,6 +143,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/corify.sml b/src/corify.sml index b4a7108e..94654064 100644 --- a/src/corify.sml +++ b/src/corify.sml @@ -244,7 +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" + | L.CFold (k1, k2) => (L'.CFold (corifyKind k1, corifyKind k2), loc) fun corifyExp st (e, loc) = case e of diff --git a/src/monoize.sml b/src/monoize.sml index 310abc6a..f8a0d96e 100644 --- a/src/monoize.sml +++ b/src/monoize.sml @@ -71,6 +71,7 @@ fun monoType env (all as (c, loc)) = | L.CRecord _ => poly () | L.CConcat _ => poly () + | L.CFold _ => poly () end val dummyExp = (L'.EPrim (Prim.Int 0), E.dummySpan) |