From efb57925196e6a6384086497ad9966d6159ff09a Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Sun, 3 May 2009 12:36:25 -0400 Subject: css demo --- demo/css.ur | 11 +++++++++++ demo/css.urp | 4 ++++ demo/css.urs | 1 + demo/prose | 4 ++++ lib/ur/basis.urs | 3 ++- src/monoize.sml | 2 +- 6 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 demo/css.ur create mode 100644 demo/css.urp create mode 100644 demo/css.urs diff --git a/demo/css.ur b/demo/css.ur new file mode 100644 index 00000000..0c1d8f70 --- /dev/null +++ b/demo/css.ur @@ -0,0 +1,11 @@ +style quote + +fun main () = return + + + + + +
Here's a quote.
+ +
diff --git a/demo/css.urp b/demo/css.urp new file mode 100644 index 00000000..150808de --- /dev/null +++ b/demo/css.urp @@ -0,0 +1,4 @@ +allow url http://adam.chlipala.net/style.css +rewrite style Css/quote quote + +css diff --git a/demo/css.urs b/demo/css.urs new file mode 100644 index 00000000..6ac44e0b --- /dev/null +++ b/demo/css.urs @@ -0,0 +1 @@ +val main : unit -> transaction page diff --git a/demo/prose b/demo/prose index c6acf57d..4eb5fe93 100644 --- a/demo/prose +++ b/demo/prose @@ -70,6 +70,10 @@ url.urp

Further, each Ur/Web application enforces a global condition on which strings are allowed as URLs. The .urp file for this demo shows an example that specifies particular rules about which URLs are allowed. You can try entering a variety of URLs on the form on the front page. Only those satisfying the allow url/deny url conditions should be permitted.

+css.urp + +

Ur/Web supports a structured approach to Cascading Style Sheets, where each style is a first-class value within a module. This demo shows the importing of an external style sheet with one style. By default, like other Ur/Web entities, the name of the style would be Css_quote. We use the rewrite directive in the .urp file to specify an alternate name for a particular canonical module path. The external style sheet contains a definition of a style with the alternate name that we give.

+ listShop.urp

This example shows off algebraic datatypes, parametric polymorphism, and functors.

diff --git a/lib/ur/basis.urs b/lib/ur/basis.urs index 25ad2786..ea4432cd 100644 --- a/lib/ur/basis.urs +++ b/lib/ur/basis.urs @@ -31,7 +31,7 @@ val neg : t ::: Type -> num t -> t -> t val plus : t ::: Type -> num t -> t -> t -> t val minus : t ::: Type -> num t -> t -> t -> t val times : t ::: Type -> num t -> t -> t -> t -val div : 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 num_int : num int val num_float : num float @@ -536,6 +536,7 @@ con bodyTagStandalone = fn (attrs :: {Type}) => val br : bodyTagStandalone [] val span : bodyTag [] +val div : bodyTag [] val p : bodyTag [] val b : bodyTag [] diff --git a/src/monoize.sml b/src/monoize.sml index 877e1a2c..4b6b3c5f 100644 --- a/src/monoize.sml +++ b/src/monoize.sml @@ -811,7 +811,7 @@ 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), "Times"), loc)), loc), fm) end - | L.ECApp ((L.EFfi ("Basis", "div"), _), t) => + | L.ECApp ((L.EFfi ("Basis", "divide"), _), t) => let val t = monoType env t in -- cgit v1.2.3