From 550c44b258fcbb3248cda6c6401ae17f513d0ba5 Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Wed, 28 Nov 2012 11:45:46 -0500 Subject: Rename Basis.exp to Basis.pow, to avoid confusion with 'expression'; add a test case for it --- lib/ur/basis.urs | 2 +- src/monoize.sml | 10 +++++----- tests/pow.ur | 4 ++++ 3 files changed, 10 insertions(+), 6 deletions(-) create mode 100644 tests/pow.ur diff --git a/lib/ur/basis.urs b/lib/ur/basis.urs index 67564108..339e8f0a 100644 --- a/lib/ur/basis.urs +++ b/lib/ur/basis.urs @@ -42,7 +42,7 @@ val minus : t ::: Type -> num t -> t -> t -> t val times : t ::: Type -> num t -> t -> t -> t val divide : t ::: Type -> num t -> t -> t -> t val mod : t ::: Type -> num t -> t -> t -> t -val exp : t ::: Type -> num t -> t -> t -> t +val pow : t ::: Type -> num t -> t -> t -> t val num_int : num int val num_float : num float diff --git a/src/monoize.sml b/src/monoize.sml index bee3fe97..b51c5d77 100644 --- a/src/monoize.sml +++ b/src/monoize.sml @@ -192,7 +192,7 @@ fun monoType env = ("Times", (L'.TFun (t, (L'.TFun (t, t), loc)), loc)), ("Div", (L'.TFun (t, (L'.TFun (t, t), loc)), loc)), ("Mod", (L'.TFun (t, (L'.TFun (t, t), loc)), loc)), - ("Exp", (L'.TFun (t, (L'.TFun (t, t), loc)), loc))], + ("Pow", (L'.TFun (t, (L'.TFun (t, t), loc)), loc))], loc) end | L.CApp ((L.CFfi ("Basis", "ord"), _), t) => @@ -793,7 +793,7 @@ fun monoExp (env, st, fm) (all as (e, loc)) = ("Times", (L'.TFun (t, (L'.TFun (t, t), loc)), loc)), ("Div", (L'.TFun (t, (L'.TFun (t, t), loc)), loc)), ("Mod", (L'.TFun (t, (L'.TFun (t, t), loc)), loc)), - ("Exp", (L'.TFun (t, (L'.TFun (t, t), loc)), loc))], loc) + ("Pow", (L'.TFun (t, (L'.TFun (t, t), loc)), loc))], loc) fun numEx (t, zero, neg, plus, minus, times, dv, md, ex) = ((L'.ERecord [("Zero", (L'.EPrim zero, loc), t), ("Neg", neg, (L'.TFun (t, t), loc)), @@ -802,7 +802,7 @@ fun monoExp (env, st, fm) (all as (e, loc)) = ("Times", times, (L'.TFun (t, (L'.TFun (t, t), loc)), loc)), ("Div", dv, (L'.TFun (t, (L'.TFun (t, t), loc)), loc)), ("Mod", md, (L'.TFun (t, (L'.TFun (t, t), loc)), loc)), - ("Exp", ex, (L'.TFun (t, (L'.TFun (t, t), loc)), loc))], loc), fm) + ("Pow", ex, (L'.TFun (t, (L'.TFun (t, t), loc)), loc))], loc), fm) fun ordTy t = (L'.TRecord [("Lt", (L'.TFun (t, (L'.TFun (t, (L'.TFfi ("Basis", "bool"), loc)), loc)), loc)), @@ -1032,12 +1032,12 @@ fun monoExp (env, st, fm) (all as (e, loc)) = ((L'.EAbs ("r", numTy t, (L'.TFun (t, (L'.TFun (t, t), loc)), loc), (L'.EField ((L'.ERel 0, loc), "Mod"), loc)), loc), fm) end - | L.ECApp ((L.EFfi ("Basis", "exp"), _), t) => + | L.ECApp ((L.EFfi ("Basis", "pow"), _), t) => let val t = monoType env t in ((L'.EAbs ("r", numTy t, (L'.TFun (t, (L'.TFun (t, t), loc)), loc), - (L'.EField ((L'.ERel 0, loc), "Exp"), loc)), loc), fm) + (L'.EField ((L'.ERel 0, loc), "Pow"), loc)), loc), fm) end | L.EFfi ("Basis", "num_int") => let diff --git a/tests/pow.ur b/tests/pow.ur new file mode 100644 index 00000000..f03fe47b --- /dev/null +++ b/tests/pow.ur @@ -0,0 +1,4 @@ +fun main () : transaction page = return +
  • 2^4 = {[pow 2 4]}
  • +
  • 3.4^5.6 = {[pow 3.4 5.6]}
  • +
    -- cgit v1.2.3