comparison src/marshalcheck.sml @ 807:61a1f5c5ae2c

Mutual datatypes through Effectize
author Adam Chlipala <adamc@hcoop.net>
date Sat, 16 May 2009 15:45:12 -0400
parents a28982de5645
children 72670131dace
comparison
equal deleted inserted replaced
806:0e554bfd6d6a 807:61a1f5c5ae2c
73 fun sins cmap = U.Con.fold {kind = kind, con = con cmap} PS.empty 73 fun sins cmap = U.Con.fold {kind = kind, con = con cmap} PS.empty
74 in 74 in
75 ignore (foldl (fn ((d, _), (cmap, emap)) => 75 ignore (foldl (fn ((d, _), (cmap, emap)) =>
76 case d of 76 case d of
77 DCon (_, n, _, c) => (IM.insert (cmap, n, sins cmap c), emap) 77 DCon (_, n, _, c) => (IM.insert (cmap, n, sins cmap c), emap)
78 | DDatatype (_, n, _, xncs) => 78 | DDatatype dts =>
79 (IM.insert (cmap, n, foldl (fn ((_, _, co), s) => 79 (foldl (fn ((_, n, _, xncs), cmap) =>
80 case co of 80 IM.insert (cmap, n, foldl (fn ((_, _, co), s) =>
81 NONE => s 81 case co of
82 | SOME c => PS.union (s, sins cmap c)) 82 NONE => s
83 PS.empty xncs), 83 | SOME c => PS.union (s, sins cmap c))
84 PS.empty xncs)) cmap dts,
84 emap) 85 emap)
85 86
86 | DVal (_, n, t, _, tag) => (cmap, IM.insert (emap, n, (t, tag))) 87 | DVal (_, n, t, _, tag) => (cmap, IM.insert (emap, n, (t, tag)))
87 | DValRec vis => (cmap, 88 | DValRec vis => (cmap,
88 foldl (fn ((_, n, t, _, tag), emap) => IM.insert (emap, n, (t, tag))) 89 foldl (fn ((_, n, t, _, tag), emap) => IM.insert (emap, n, (t, tag)))