Mercurial > urweb
comparison src/shake.sml @ 807:61a1f5c5ae2c
Mutual datatypes through Effectize
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Sat, 16 May 2009 15:45:12 -0400 |
parents | 8688e01ae469 |
children | ed06e25c70ef |
comparison
equal
deleted
inserted
replaced
806:0e554bfd6d6a | 807:61a1f5c5ae2c |
---|---|
67 (usedE, usedC, c :: table_cs) | 67 (usedE, usedC, c :: table_cs) |
68 end | 68 end |
69 | (_, acc) => acc) (IS.empty, IS.empty, []) file | 69 | (_, acc) => acc) (IS.empty, IS.empty, []) file |
70 | 70 |
71 val (cdef, edef) = foldl (fn ((DCon (_, n, _, c), _), (cdef, edef)) => (IM.insert (cdef, n, [c]), edef) | 71 val (cdef, edef) = foldl (fn ((DCon (_, n, _, c), _), (cdef, edef)) => (IM.insert (cdef, n, [c]), edef) |
72 | ((DDatatype (_, n, _, xncs), _), (cdef, edef)) => | 72 | ((DDatatype dts, _), (cdef, edef)) => |
73 (IM.insert (cdef, n, List.mapPartial #3 xncs), edef) | 73 (foldl (fn ((_, n, _, xncs), cdef) => |
74 IM.insert (cdef, n, List.mapPartial #3 xncs)) cdef dts, edef) | |
74 | ((DVal (_, n, t, e, _), _), (cdef, edef)) => (cdef, IM.insert (edef, n, ([], t, e))) | 75 | ((DVal (_, n, t, e, _), _), (cdef, edef)) => (cdef, IM.insert (edef, n, ([], t, e))) |
75 | ((DValRec vis, _), (cdef, edef)) => | 76 | ((DValRec vis, _), (cdef, edef)) => |
76 let | 77 let |
77 val all_ns = map (fn (_, n, _, _, _) => n) vis | 78 val all_ns = map (fn (_, n, _, _, _) => n) vis |
78 in | 79 in |
155 end) s usedE | 156 end) s usedE |
156 | 157 |
157 val s = foldl (fn (c, s) => shakeCon s c) s table_cs | 158 val s = foldl (fn (c, s) => shakeCon s c) s table_cs |
158 in | 159 in |
159 List.filter (fn (DCon (_, n, _, _), _) => IS.member (#con s, n) | 160 List.filter (fn (DCon (_, n, _, _), _) => IS.member (#con s, n) |
160 | (DDatatype (_, n, _, _), _) => IS.member (#con s, n) | 161 | (DDatatype dts, _) => List.exists (fn (_, n, _, _) => IS.member (#con s, n)) dts |
161 | (DVal (_, n, _, _, _), _) => IS.member (#exp s, n) | 162 | (DVal (_, n, _, _, _), _) => IS.member (#exp s, n) |
162 | (DValRec vis, _) => List.exists (fn (_, n, _, _, _) => IS.member (#exp s, n)) vis | 163 | (DValRec vis, _) => List.exists (fn (_, n, _, _, _) => IS.member (#exp s, n)) vis |
163 | (DExport _, _) => true | 164 | (DExport _, _) => true |
164 | (DView _, _) => true | 165 | (DView _, _) => true |
165 | (DSequence _, _) => true | 166 | (DSequence _, _) => true |