diff options
author | Adam Chlipala <adamc@hcoop.net> | 2008-08-03 10:48:36 -0400 |
---|---|---|
committer | Adam Chlipala <adamc@hcoop.net> | 2008-08-03 10:48:36 -0400 |
commit | c0b7963e91681045bb4c82a2356776fae54f54c5 (patch) | |
tree | 5f098f60e48ade5cd1bfcb3a69e9b4ef9cb605ff /src/mono_util.sml | |
parent | 5e0563d3b00303d5053827e46811c93077455208 (diff) |
Cases through monoize
Diffstat (limited to 'src/mono_util.sml')
-rw-r--r-- | src/mono_util.sml | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/mono_util.sml b/src/mono_util.sml index 970f3fa0..4414385d 100644 --- a/src/mono_util.sml +++ b/src/mono_util.sml @@ -185,8 +185,22 @@ fun mapfoldB {typ = fc, exp = fe, bind} = S.bind2 (mfe ctx e, fn e' => S.bind2 (ListUtil.mapfold (fn (p, e) => - S.map2 (mfe ctx e, - fn e' => (p, e'))) pes, + let + val dummyt = (TFfi ("", ""), ErrorMsg.dummySpan) + + fun pb ((p, _), ctx) = + case p of + PWild => ctx + | PVar x => bind (ctx, RelE (x, dummyt)) + | PPrim _ => ctx + | PCon (_, NONE) => ctx + | PCon (_, SOME p) => pb (p, ctx) + | PRecord xps => foldl (fn ((_, p), ctx) => + pb (p, ctx)) ctx xps + in + S.map2 (mfe (pb (p, ctx)) e, + fn e' => (p, e')) + end) pes, fn pes' => S.map2 (mft t, fn t' => |