Mercurial > urweb
comparison src/mono_util.sml @ 179:3bbed533fbd2
Cases through monoize
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Sun, 03 Aug 2008 10:48:36 -0400 |
parents | eb3f9913bf31 |
children | d11754ffe252 |
comparison
equal
deleted
inserted
replaced
178:eb3f9913bf31 | 179:3bbed533fbd2 |
---|---|
183 | 183 |
184 | ECase (e, pes, t) => | 184 | ECase (e, pes, t) => |
185 S.bind2 (mfe ctx e, | 185 S.bind2 (mfe ctx e, |
186 fn e' => | 186 fn e' => |
187 S.bind2 (ListUtil.mapfold (fn (p, e) => | 187 S.bind2 (ListUtil.mapfold (fn (p, e) => |
188 S.map2 (mfe ctx e, | 188 let |
189 fn e' => (p, e'))) pes, | 189 val dummyt = (TFfi ("", ""), ErrorMsg.dummySpan) |
190 | |
191 fun pb ((p, _), ctx) = | |
192 case p of | |
193 PWild => ctx | |
194 | PVar x => bind (ctx, RelE (x, dummyt)) | |
195 | PPrim _ => ctx | |
196 | PCon (_, NONE) => ctx | |
197 | PCon (_, SOME p) => pb (p, ctx) | |
198 | PRecord xps => foldl (fn ((_, p), ctx) => | |
199 pb (p, ctx)) ctx xps | |
200 in | |
201 S.map2 (mfe (pb (p, ctx)) e, | |
202 fn e' => (p, e')) | |
203 end) pes, | |
190 fn pes' => | 204 fn pes' => |
191 S.map2 (mft t, | 205 S.map2 (mft t, |
192 fn t' => | 206 fn t' => |
193 (ECase (e', pes', t'), loc)))) | 207 (ECase (e', pes', t'), loc)))) |
194 | 208 |