diff src/shake.sml @ 163:80192edca30d

Datatypes through corify
author Adam Chlipala <adamc@hcoop.net>
date Tue, 29 Jul 2008 13:16:21 -0400
parents f0d3402184d1
children 9bbf4d383381
line wrap: on
line diff
--- a/src/shake.sml	Tue Jul 29 12:30:04 2008 -0400
+++ b/src/shake.sml	Tue Jul 29 13:16:21 2008 -0400
@@ -47,7 +47,9 @@
                           (fn ((DExport (_, n), _), page_es) => n :: page_es
                             | (_, page_es) => page_es) [] file
 
-        val (cdef, edef) = foldl (fn ((DCon (_, n, _, c), _), (cdef, edef)) => (IM.insert (cdef, n, c), edef)
+        val (cdef, edef) = foldl (fn ((DCon (_, n, _, c), _), (cdef, edef)) => (IM.insert (cdef, n, [c]), edef)
+                                   | ((DDatatype (_, n, xncs), _), (cdef, edef)) =>
+                                     (IM.insert (cdef, n, List.mapPartial #3 xncs), edef)
                                    | ((DVal (_, n, t, e, _), _), (cdef, edef)) => (cdef, IM.insert (edef, n, (t, e)))
                                    | ((DValRec vis, _), (cdef, edef)) =>
                                      (cdef, foldl (fn ((_, n, t, e, _), edef) => IM.insert (edef, n, (t, e))) edef vis)
@@ -68,7 +70,7 @@
                     in
                         case IM.find (cdef, n) of
                             NONE => s'
-                          | SOME c => shakeCon s' c
+                          | SOME cs => foldl (fn (c, s') => shakeCon s' c) s' cs
                     end
               | _ => s
 
@@ -100,6 +102,7 @@
                             | SOME (t, e) => shakeExp (shakeCon s t) e) s page_es
     in
         List.filter (fn (DCon (_, n, _, _), _) => IS.member (#con s, n)
+                      | (DDatatype (_, n, _), _) => IS.member (#con s, n)
                       | (DVal (_, n, _, _, _), _) => IS.member (#exp s, n)
                       | (DValRec vis, _) => List.exists (fn (_, n, _, _, _) => IS.member (#exp s, n)) vis
                       | (DExport _, _) => true) file