Mercurial > urweb
comparison src/monoize.sml @ 1832:373e2c3f03b2
Rename Basis.exp to Basis.pow, to avoid confusion with 'expression'; add a test case for it
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Wed, 28 Nov 2012 11:45:46 -0500 |
parents | 36428d853c97 |
children | be0c4e2e488a |
comparison
equal
deleted
inserted
replaced
1831:36428d853c97 | 1832:373e2c3f03b2 |
---|---|
190 ("Plus", (L'.TFun (t, (L'.TFun (t, t), loc)), loc)), | 190 ("Plus", (L'.TFun (t, (L'.TFun (t, t), loc)), loc)), |
191 ("Minus", (L'.TFun (t, (L'.TFun (t, t), loc)), loc)), | 191 ("Minus", (L'.TFun (t, (L'.TFun (t, t), loc)), loc)), |
192 ("Times", (L'.TFun (t, (L'.TFun (t, t), loc)), loc)), | 192 ("Times", (L'.TFun (t, (L'.TFun (t, t), loc)), loc)), |
193 ("Div", (L'.TFun (t, (L'.TFun (t, t), loc)), loc)), | 193 ("Div", (L'.TFun (t, (L'.TFun (t, t), loc)), loc)), |
194 ("Mod", (L'.TFun (t, (L'.TFun (t, t), loc)), loc)), | 194 ("Mod", (L'.TFun (t, (L'.TFun (t, t), loc)), loc)), |
195 ("Exp", (L'.TFun (t, (L'.TFun (t, t), loc)), loc))], | 195 ("Pow", (L'.TFun (t, (L'.TFun (t, t), loc)), loc))], |
196 loc) | 196 loc) |
197 end | 197 end |
198 | L.CApp ((L.CFfi ("Basis", "ord"), _), t) => | 198 | L.CApp ((L.CFfi ("Basis", "ord"), _), t) => |
199 let | 199 let |
200 val t = mt env dtmap t | 200 val t = mt env dtmap t |
791 ("Plus", (L'.TFun (t, (L'.TFun (t, t), loc)), loc)), | 791 ("Plus", (L'.TFun (t, (L'.TFun (t, t), loc)), loc)), |
792 ("Minus", (L'.TFun (t, (L'.TFun (t, t), loc)), loc)), | 792 ("Minus", (L'.TFun (t, (L'.TFun (t, t), loc)), loc)), |
793 ("Times", (L'.TFun (t, (L'.TFun (t, t), loc)), loc)), | 793 ("Times", (L'.TFun (t, (L'.TFun (t, t), loc)), loc)), |
794 ("Div", (L'.TFun (t, (L'.TFun (t, t), loc)), loc)), | 794 ("Div", (L'.TFun (t, (L'.TFun (t, t), loc)), loc)), |
795 ("Mod", (L'.TFun (t, (L'.TFun (t, t), loc)), loc)), | 795 ("Mod", (L'.TFun (t, (L'.TFun (t, t), loc)), loc)), |
796 ("Exp", (L'.TFun (t, (L'.TFun (t, t), loc)), loc))], loc) | 796 ("Pow", (L'.TFun (t, (L'.TFun (t, t), loc)), loc))], loc) |
797 fun numEx (t, zero, neg, plus, minus, times, dv, md, ex) = | 797 fun numEx (t, zero, neg, plus, minus, times, dv, md, ex) = |
798 ((L'.ERecord [("Zero", (L'.EPrim zero, loc), t), | 798 ((L'.ERecord [("Zero", (L'.EPrim zero, loc), t), |
799 ("Neg", neg, (L'.TFun (t, t), loc)), | 799 ("Neg", neg, (L'.TFun (t, t), loc)), |
800 ("Plus", plus, (L'.TFun (t, (L'.TFun (t, t), loc)), loc)), | 800 ("Plus", plus, (L'.TFun (t, (L'.TFun (t, t), loc)), loc)), |
801 ("Minus", minus, (L'.TFun (t, (L'.TFun (t, t), loc)), loc)), | 801 ("Minus", minus, (L'.TFun (t, (L'.TFun (t, t), loc)), loc)), |
802 ("Times", times, (L'.TFun (t, (L'.TFun (t, t), loc)), loc)), | 802 ("Times", times, (L'.TFun (t, (L'.TFun (t, t), loc)), loc)), |
803 ("Div", dv, (L'.TFun (t, (L'.TFun (t, t), loc)), loc)), | 803 ("Div", dv, (L'.TFun (t, (L'.TFun (t, t), loc)), loc)), |
804 ("Mod", md, (L'.TFun (t, (L'.TFun (t, t), loc)), loc)), | 804 ("Mod", md, (L'.TFun (t, (L'.TFun (t, t), loc)), loc)), |
805 ("Exp", ex, (L'.TFun (t, (L'.TFun (t, t), loc)), loc))], loc), fm) | 805 ("Pow", ex, (L'.TFun (t, (L'.TFun (t, t), loc)), loc))], loc), fm) |
806 | 806 |
807 fun ordTy t = | 807 fun ordTy t = |
808 (L'.TRecord [("Lt", (L'.TFun (t, (L'.TFun (t, (L'.TFfi ("Basis", "bool"), loc)), loc)), loc)), | 808 (L'.TRecord [("Lt", (L'.TFun (t, (L'.TFun (t, (L'.TFfi ("Basis", "bool"), loc)), loc)), loc)), |
809 ("Le", (L'.TFun (t, (L'.TFun (t, (L'.TFfi ("Basis", "bool"), loc)), loc)), loc))], loc) | 809 ("Le", (L'.TFun (t, (L'.TFun (t, (L'.TFfi ("Basis", "bool"), loc)), loc)), loc))], loc) |
810 fun ordEx (t, lt, le) = | 810 fun ordEx (t, lt, le) = |
1030 val t = monoType env t | 1030 val t = monoType env t |
1031 in | 1031 in |
1032 ((L'.EAbs ("r", numTy t, (L'.TFun (t, (L'.TFun (t, t), loc)), loc), | 1032 ((L'.EAbs ("r", numTy t, (L'.TFun (t, (L'.TFun (t, t), loc)), loc), |
1033 (L'.EField ((L'.ERel 0, loc), "Mod"), loc)), loc), fm) | 1033 (L'.EField ((L'.ERel 0, loc), "Mod"), loc)), loc), fm) |
1034 end | 1034 end |
1035 | L.ECApp ((L.EFfi ("Basis", "exp"), _), t) => | 1035 | L.ECApp ((L.EFfi ("Basis", "pow"), _), t) => |
1036 let | 1036 let |
1037 val t = monoType env t | 1037 val t = monoType env t |
1038 in | 1038 in |
1039 ((L'.EAbs ("r", numTy t, (L'.TFun (t, (L'.TFun (t, t), loc)), loc), | 1039 ((L'.EAbs ("r", numTy t, (L'.TFun (t, (L'.TFun (t, t), loc)), loc), |
1040 (L'.EField ((L'.ERel 0, loc), "Exp"), loc)), loc), fm) | 1040 (L'.EField ((L'.ERel 0, loc), "Pow"), loc)), loc), fm) |
1041 end | 1041 end |
1042 | L.EFfi ("Basis", "num_int") => | 1042 | L.EFfi ("Basis", "num_int") => |
1043 let | 1043 let |
1044 fun intBin s = | 1044 fun intBin s = |
1045 (L'.EAbs ("x", (L'.TFfi ("Basis", "int"), loc), | 1045 (L'.EAbs ("x", (L'.TFfi ("Basis", "int"), loc), |