Ur/Web Tutorial

Ur/Web Tutorial

Gian Perrone - April 2011

Updated: 4 Jan 2013 - The way Ur/Web handled event handlers changed, and so some of the code samples in this tutorial were no longer correct. This has been remedied. Also, the way Github served static files changed sufficiently to break the CSS includes used in previous versions. I have replaced these links with versions on this server that you can hotlink to run your examples. You will need to use the latest version of Ur/Web. Please let me know if you experience any difficulties.

This is an introductory tutorial designed to get you started constructing applications in Ur/Web, a modern, functional language for constructing web applications. This tutorial takes the form of an example application, and a guide explaining the steps of construction.

The Application

We're going to construct a very simple blog system. It doesn't aim to be particularly functional; rather, we aim only to construct something that will demonstrate enough of the features (and ultimate value) of Ur/Web. This system is known as 'UrBlog'.

Installing Ur/Web

You're going to require a working installation of Ur/Web before you can actually run the examples. This is basically a matter of downloading Ur/Web, building, and then installing. There can be some subtleties in the build process, however. The actual installation process is outside the scope of this tutorial, so if you don't have a working installation already, you should read the Ur/Web site, particularly the Reference Manual, which should probably be your first port of call when any confusion arises.

Prerequisites

If you've never touched a functional programming language, particularly a strongly typed language such as ML or Haskell, you're probably not going to be able to follow this tutorial. I would recommend learning something about one (or both) of those languages first, and then returning to Ur/Web.

Tutorial Source Code

All of the tutorial source code is available from GitHub:

https://github.com/gian/urtutorial

If you would like to just download a tar.gz with everything in it, you can use this link:

https://github.com/gian/urtutorial/tarball/master

Contents