Category Archives: Java

Functional Programming on Android

I’ve integrated CAL with a variety of Java based frameworks/environments: Tapestry, GWT and Google AppEngine for instance.

Recently someone asked on the CAL Google Group whether CAL programs could run on Android mobile devices. Android doesn’t use a standard JVM, it uses Dalvik, and it provides a subset of the normal JRE library.

I have put together [...]

Reconsidering my Combinators

Since writing my set of function combinators for matching HTTP requests I’ve realised that there are better approaches.

While the combinators read nicely, once you start extracting attributes from the request things become messy, due to the hAnd combinator composing results as nested pairs.

Here’s an example:

skitchPutHandler = let [...]

CAL Hangman on GAE Part 2 — The Datastore


My implementation of Hangman has only very simple data storage requirements, so my CAL module Datastore doesn’t cover the entire capabilities of Bigtable.

All the application needs is to be able to save a Game instance, put the key of that instance into a cookie in the user’s browser, and then retrieve and update that instance [...]

CAL Hangman on Google AppEngine, Part 1

This post describes a simple implementation of the game ‘Hangman’, written in CAL for Google Appengine.


Hangman is a simple word guessing game — the computer chooses a word, telling you only how many letters it has. You that it contains a particular letter. Correct guesses fill in those letters in the word, until you have [...]

Functional Programming on Google AppEngine

I’ve always hoped that Java would be the next Google App Engine language. Google have provided a solid platform with a ‘real’ JVM and few restrictions.

I deployed the sample application created with the Eclipse plugins a few minutes after my account was upgraded to support Java, and then I went on to deploy an application [...]

bash command completion for jstack/jps

I’ve only recently become aware of jps and jstack, Sun’s tools for listing Java processes and for producing a thread dump from them. They beat the old ps | fgrep java and kill -3 (and then try to find the log file your thread dump went into…).

You still have to use jps, copy the appropriate [...]

A CAL webapp with persistent data using GWT, STM and BDB

aka, attack of the TLAs.

This webapp’s architecture is depicted below:

The browser runs a Javascript thick client compiled from Java by GWT. Some of the classes have CAL annotations. These don’t affect the client, but allow the server side of the GWT RPC protocol to call CAL functions. The CAL functions store persistent data using Software Transactional [...]

GWT as a CAL client

I’ve been interested in GWT as a way of building rich Internet applications since it appeared, and I’m very pleased to see it getting better and better.

So it’s natural that I’d want to try using it with CAL, a functional language quite similar to Haskell which runs on the JVM.

I used a similar approach to [...]

Confluence, Spotlight and Hessian

My choice for the highlight of OS X 10.5, Leopard, is that Spotlight is worth using. It’s fast enough that it’s replaced Quicksilver (I was never a power Quicksilver user) as my application launcher.

I’ve also found it useful for general searching for emails, contacts, PDF documents and so on.

This inspired my second current spare-time project, [...]

CAL and Tapestry 5, Part 2: Algebraic Types and Forms

In my previous post I described how to use a CAL function as part of the implementation of a Java class.

This post looks at interfacing CAL to Tapestry 5 using the ‘Java Bean’ conventions of getter and setter methods for the fields in an object.

Tapestry 5 provides a BeanEditForm component which simplifies providing CRUD operations [...]