Mercurial > urweb
comparison src/elab_env.sml @ 1272:56bd4a4f6e66
Some serious bug-fix work to get HTML example to compile; this includes fixing a bug with 'val' patterns in Unnest and the need for more local reduction in Especialize
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Thu, 03 Jun 2010 13:04:37 -0400 |
parents | c316ca3c9ec6 |
children | b4480a56cab7 |
comparison
equal
deleted
inserted
replaced
1271:503d4ec93494 | 1272:56bd4a4f6e66 |
---|---|
1509 | PVar (x, t) => pushERel env x t | 1509 | PVar (x, t) => pushERel env x t |
1510 | PPrim _ => env | 1510 | PPrim _ => env |
1511 | PCon (_, _, _, NONE) => env | 1511 | PCon (_, _, _, NONE) => env |
1512 | PCon (_, _, _, SOME p) => patBinds env p | 1512 | PCon (_, _, _, SOME p) => patBinds env p |
1513 | PRecord xps => foldl (fn ((_, p, _), env) => patBinds env p) env xps | 1513 | PRecord xps => foldl (fn ((_, p, _), env) => patBinds env p) env xps |
1514 | |
1515 fun patBindsN (p, _) = | |
1516 case p of | |
1517 PWild => 0 | |
1518 | PVar _ => 1 | |
1519 | PPrim _ => 0 | |
1520 | PCon (_, _, _, NONE) => 0 | |
1521 | PCon (_, _, _, SOME p) => patBindsN p | |
1522 | PRecord xps => foldl (fn ((_, p, _), n) => patBindsN p + n) 0 xps | |
1514 | 1523 |
1515 fun edeclBinds env (d, loc) = | 1524 fun edeclBinds env (d, loc) = |
1516 case d of | 1525 case d of |
1517 EDVal (p, _, _) => patBinds env p | 1526 EDVal (p, _, _) => patBinds env p |
1518 | EDValRec vis => foldl (fn ((x, t, _), env) => pushERel env x t) env vis | 1527 | EDValRec vis => foldl (fn ((x, t, _), env) => pushERel env x t) env vis |