summaryrefslogtreecommitdiff
path: root/demo
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2008-10-21 17:12:22 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2008-10-21 17:12:22 -0400
commit5411e88620c19474569ce7c2280235beaa6cd1f5 (patch)
tree19d04e21918efc8f6e6ce4f250f027f022a17d96 /demo
parentf22e9441db7df243da8636a39d43e27adba6434a (diff)
Hello prose
Diffstat (limited to 'demo')
-rw-r--r--demo/prose8
1 files changed, 7 insertions, 1 deletions
diff --git a/demo/prose b/demo/prose
index 8be2db96..36fd14ea 100644
--- a/demo/prose
+++ b/demo/prose
@@ -26,7 +26,13 @@ ProxyPassReverse /Demo/ http://localhost:8080/</pre></blockquote></p>
hello.urp
-<p>This one is my favorite.</p>
+<p>We must, of course, begin with "Hello World."</p>
+
+<p>The project file justs list one filename prefix, <tt>hello</tt>. This causes both <tt>hello.urs</tt> and <tt>hello.ur</tt> to be pulled into the project. <tt>.urs</tt> files are like <a href="http://caml.inria.fr/ocaml/">OCaml</a> <tt>.mli</tt> files, and <tt>.ur</tt> files are like OCaml <tt>.ml</tt> files. That is, <tt>.urs</tt> files provide interfaces, and <tt>.ur</tt> files provide implementations. <tt>.urs</tt> files may be omitted for <tt>.ur</tt> files, in which case most permissive interfaces are inferred.</p>
+
+<p>Ur/Web features a module system very similar to those found in SML and OCaml. Like in OCaml, interface files are treated as module system signatures, and they are ascribed to structures built from interface files. <tt>hello.urs</tt> tells us that we only export a function named <tt>main</tt>, taking no arguments and running a transaction that results in an HTML page. <tt>transaction</tt> is a monad in the spirit of the Haskell IO monad, with the intent that every operation performable in <tt>transaction</tt> can be undone. By design, Ur/Web does not provide a less constrained way of running side-effecting actions. This particular example application will employ no side effects, but the compiler requires that all pages be generated by transactions.</p>
+
+<p>Looking at <tt>hello.ur</tt>, we see an SML-looking function definition that returns a fragment of XML, written with special syntax. This fragment is returned to browsers that request the URI <tt>/Demo/Hello/main</tt>. That is, we take the demo-wide prefix <tt>/Demo</tt> and add a suffix that indicates we want to call the <tt>main</tt> function in the <tt>Hello</tt> module. This path convention generalizes to arbitrary levels of nested module definitions and functor applications (which we will see later).</p>
link.urp