diff src/elab_util.sml @ 162:06a98129b23f

Add datatype import constructor annotations; datatypes through explify
author Adam Chlipala <adamc@hcoop.net>
date Tue, 29 Jul 2008 12:30:04 -0400
parents 34ccd7d2bea8
children c7a6e6dbc318
line wrap: on
line diff
--- a/src/elab_util.sml	Thu Jul 24 16:51:24 2008 -0400
+++ b/src/elab_util.sml	Tue Jul 29 12:30:04 2008 -0400
@@ -386,7 +386,15 @@
                                                       fn c' => (x, n, SOME c'))) xncs,
                         fn xncs' =>
                            (SgiDatatype (x, n, xncs'), loc))
-              | SgiDatatypeImp _ => S.return2 siAll
+              | 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' =>
@@ -420,7 +428,7 @@
                                                    bind (ctx, NamedC (x, k))
                                                  | SgiDatatype (x, n, xncs) =>
                                                    bind (ctx, NamedC (x, (KType, loc)))
-                                                 | SgiDatatypeImp (x, _, _, _, _) =>
+                                                 | SgiDatatypeImp (x, _, _, _, _, _) =>
                                                    bind (ctx, NamedC (x, (KType, loc)))
                                                  | SgiVal _ => ctx
                                                  | SgiStr (x, _, sgn) =>
@@ -541,7 +549,7 @@
                                                                  end)
                                                        ctx xncs
                                                    end
-                                                 | DDatatypeImp (x, n, m, ms, x') =>
+                                                 | DDatatypeImp (x, n, m, ms, x', _) =>
                                                    bind (ctx, NamedC (x, (KType, loc)))
                                                  | DVal (x, _, c, _) =>
                                                    bind (ctx, NamedE (x, c))
@@ -598,7 +606,15 @@
                                                       fn c' => (x, n, SOME c'))) xncs,
                         fn xncs' =>
                            (DDatatype (x, n, xncs'), loc))
-              | DDatatypeImp _ => S.return2 dAll
+              | DDatatypeImp (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 (mfc ctx c,
+                                                      fn c' => (x, n, SOME c'))) xncs,
+                        fn xncs' =>
+                           (DDatatypeImp (x, n, m1, ms, s, xncs'), loc))
               | DVal vi =>
                 S.map2 (mfvi ctx vi,
                      fn vi' =>