In recent years we’ve done most of our development in the functional programming language OCaml. It has power, flexibility, static type safety, and is compiled to efficient native code. The OCaml home page is www.ocaml.org.
We’ve found that OCaml’s object-oriented subsystem makes it especially useful when interfacing to existing OO libraries (like most GUI libraries in use today).
Our two released apps for iOS, Master Schnapsen/66 and Cassino, are written entirely in OCaml—aside from the necessary iOS interface layer. If you need to be convinced that OCaml actually works on iOS, try them out. Not only will you be convinced, you might also enjoy them—they’re classic card games, and our apps make challenging opponents.
On this page we offer resources for programmers who are interested in using OCaml on iOS. We always have new projects in the works, and will add them here when they’re ready.
Compilers and Libraries
We modified OCaml 4.00.0 into an iOS cross compiler—it compiles OCaml to run as a native app on iOS devices (iPhone, iPod Touch, iPad). You can download a prebuilt compiler for iOS. If you want to build the compiler yourself, you can read the instructions for building from source.
We also modified OCaml 4.00.0 into an iOS Simulator cross compiler— it compiles OCaml to run as an app in the iOS Simulator available from Apple. This is a great way to experiment with iOS OCaml programming—you don’t need a device, and don’t need to register with Apple as an iOS developer. And it’s a convenient development environment even for registered iOS developers.
You can download a prebuilt compiler for the iOS Simulator. If you want to build the iOS Simulator compiler yourself or test the prebuilt one, you can read the instructions for building and testing the compiler.
We have created an OCaml interface to OpenGL ES, by adapting the LablGL interface created by Jacques Garrigue. We’re calling it LablGLES for short. OpenGL ES is a reduced version of OpenGL, for doing graphics on small devices like the iPhone and iPad. Read the detailed instructions for building LablGLES.
These are full OCaml iOS apps that you can build from source, then run on an iOS device or in the iOS Simulator. To keep things simple we’ve packaged some of them for iOS devices and some for the iOS Simulator. The iOS Simulator apps are also available in binary form; you can just download the binary and run in the simulator. Click on the images below to go the the full page for an app.
Apps Packaged for iOS Devices
These apps are packaged to run on iOS devices (iPhone, iPod Touch, iPad). You can download the sources for an app and build it with Xcode. Then you can run it on your development devices.
Portland is a very simple iOS app that shows which side of the iOS device is facing up. The name is a combination of portrait and landscape.
Slide24 is a more realistic OCaml iOS app that has real GUI elements and animation. It plays the well known 5 x 5 sliding tile puzzle, and will solve it for you using heuristic AI techniques.
IcosaBlue uses LablGLES to display a rotating blue icosahedron. This app is also packaged for the simulator.
Apps Packaged for iOS Simulator
These apps are packaged to run in the iOS Simulator. You can download sources for an app and build with Xcode. Then you can run it in the Simulator. You can also download a prebuilt binary and execute it immediately in the Simulator.
Gamut shows a changing display in all the possible colors, depending on where you touch the screen.
Voronoi displays cool pictures based on colored Voronoi diagrams that you can modify dynamically through the touch interface.
IcosaBlue uses LablGLES to display a rotating blue icosahedron. This app is also packaged for iOS devices.
Earlier versions of these binaries, patches, and sources are available in our OCaml Programming Archives.