summaryrefslogtreecommitdiff
path: root/src/mono_util.sml
diff options
context:
space:
mode:
Diffstat (limited to 'src/mono_util.sml')
-rw-r--r--src/mono_util.sml18
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' =>