diff 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
line wrap: on
line diff
--- a/src/mono_util.sml	Sun Aug 03 09:26:49 2008 -0400
+++ b/src/mono_util.sml	Sun Aug 03 10:48:36 2008 -0400
@@ -185,8 +185,22 @@
                 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' =>