changeset 407:345fcf91c806

Rec demo
author Adam Chlipala <adamc@hcoop.net>
date Tue, 21 Oct 2008 17:34:20 -0400
parents a71600cac815
children de3b03e22447
files demo/prose demo/rec.ur demo/rec.urp demo/rec.urs lib/basis.urs
diffstat 5 files changed, 15 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/demo/prose	Tue Oct 21 17:30:06 2008 -0400
+++ b/demo/prose	Tue Oct 21 17:34:20 2008 -0400
@@ -38,6 +38,10 @@
 
 <p>In <tt>link.ur</tt>, we see how easy it is to link to another page.  The Ur/Web compiler guarantees that all links are valid.  We just write some Ur/Web code inside an "antiquote" in our XML, denoting a transaction that will produce the new page if the link is clicked.</p>
 
+rec.urp
+
+<p>Crafting webs of interlinked pages is easy, using recursion.</p>
+
 form.urp
 
 <p>Here we see a basic form.  The type system tracks which form inputs we include, and it enforces that the form handler function expects a record containing exactly those fields, with exactly the proper types.</p>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/demo/rec.ur	Tue Oct 21 17:34:20 2008 -0400
@@ -0,0 +1,7 @@
+fun main () = return <xml><body>
+  <a link={other ()}>Go to the other one!</a>
+</body></xml>
+
+and other () = return <xml><body>
+  <a link={main ()}>Return to <tt>main</tt>!</a>
+</body></xml>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/demo/rec.urp	Tue Oct 21 17:34:20 2008 -0400
@@ -0,0 +1,2 @@
+
+rec
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/demo/rec.urs	Tue Oct 21 17:34:20 2008 -0400
@@ -0,0 +1,1 @@
+val main : unit -> transaction page
--- a/lib/basis.urs	Tue Oct 21 17:30:06 2008 -0400
+++ b/lib/basis.urs	Tue Oct 21 17:34:20 2008 -0400
@@ -333,6 +333,7 @@
 val p : bodyTag []
 val b : bodyTag []
 val i : bodyTag []
+val tt : bodyTag []
 val font : bodyTag [Size = int, Face = string]
 
 val h1 : bodyTag []