summaryrefslogtreecommitdiff
path: root/src/expl_util.sml
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2008-07-29 12:30:04 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2008-07-29 12:30:04 -0400
commit4cbbb0bb751dd9e9dae9d6b621e563ee5c7ae1b4 (patch)
tree13fe85f442a35d516a1591c98af5b85e0cf1f6b7 /src/expl_util.sml
parent21f2ec92093d2b00afe3d36476f20f45b4d4a194 (diff)
Add datatype import constructor annotations; datatypes through explify
Diffstat (limited to 'src/expl_util.sml')
-rw-r--r--src/expl_util.sml24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/expl_util.sml b/src/expl_util.sml
index 976df246..e1a5d30f 100644
--- a/src/expl_util.sml
+++ b/src/expl_util.sml
@@ -342,7 +342,7 @@ fun mapfoldB {kind, con, sgn_item, sgn, bind} =
fun sgi ctx si acc =
S.bindP (sgi' ctx si acc, sgn_item ctx)
- and sgi' ctx (si, loc) =
+ and sgi' ctx (siAll as (si, loc)) =
case si of
SgiConAbs (x, n, k) =>
S.map2 (kind k,
@@ -354,6 +354,24 @@ fun mapfoldB {kind, con, sgn_item, sgn, bind} =
S.map2 (con ctx c,
fn c' =>
(SgiCon (x, n, k', c'), loc)))
+ | SgiDatatype (x, n, xncs) =>
+ S.map2 (ListUtil.mapfold (fn (x, n, c) =>
+ case c of
+ NONE => S.return2 (x, n, c)
+ | SOME c =>
+ S.map2 (con ctx c,
+ fn c' => (x, n, SOME c'))) xncs,
+ fn xncs' =>
+ (SgiDatatype (x, n, xncs'), loc))
+ | SgiDatatypeImp (x, n, m1, ms, s, xncs) =>
+ S.map2 (ListUtil.mapfold (fn (x, n, c) =>
+ case c of
+ NONE => S.return2 (x, n, c)
+ | SOME c =>
+ S.map2 (con ctx c,
+ fn c' => (x, n, SOME c'))) xncs,
+ fn xncs' =>
+ (SgiDatatypeImp (x, n, m1, ms, s, xncs'), loc))
| SgiVal (x, n, c) =>
S.map2 (con ctx c,
fn c' =>
@@ -379,6 +397,10 @@ fun mapfoldB {kind, con, sgn_item, sgn, bind} =
bind (ctx, NamedC (x, k))
| SgiCon (x, _, k, _) =>
bind (ctx, NamedC (x, k))
+ | SgiDatatype (x, n, xncs) =>
+ bind (ctx, NamedC (x, (KType, loc)))
+ | SgiDatatypeImp (x, _, _, _, _, _) =>
+ bind (ctx, NamedC (x, (KType, loc)))
| SgiVal _ => ctx
| SgiStr (x, _, sgn) =>
bind (ctx, Str (x, sgn))