Category:Web/Mobile Applications

From HaskellWiki
< Category:Web
Revision as of 12:37, 7 August 2010 by Andrewufrank (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Mobile Web applications

Programming of web applications in Haskell would be awesom; this page collects experiences with different approaches. I reflects experiments carried out in August 2010 - updates are encouraged, corrections invited! (There is a 2010 wiki page 'web'[] which discusses web related packages and an old, seriously outdated page 'practical web programming in Haskell' [1])

The ultimate goal is to produce web apps written in Haskell which run in any browser without installation (client-side web app [2]]; this seem not achievable summer 2010. The second best thing is translating Haskell code to pieces which can be served by a web server (server-side web app). If this webserver is a standard web server, possibly running on a mobile device, then not much difference is to the client-side solution.

The difference is whether an application can run in a mobile device eventhough no web connection is available or not:

Internet connection independent web apps for mobile devices

The following focuses on Android based mobile devices - for iPhone the problems are likely more complicated due to the restrictions enforced by Apple.

The options to produce code running on a mobile device from Haskell sources are: - porting a Haskell compiler to the device or using a cross compiler; there is some progress to produce a ghc version fro Maemo ([3]);

- compiling Haskell code to java byte code for the Java VM (or Dalvik for Android); discussions can be found on Haskell-cafe, but they are not encouraging;

- compiling Haskell to javascript; several project are found on Hackage:

Haskell to Javascript

The effort to use the York Haskell compiler and its intermediate code to produce javascript was started 2006 [4]. In 2010 it seems mostly abandoned:

Yhc can be downloade from hackage, but i could not get it compiled [5]; it seems that some parts are missing, especially the run time environment yhi -- but perhaps just some more instructions would make it work.

Yhccore seems part of an effort to produce the yhc intermediate language from ghc (at least that is my understanding) which could then be used by others to translate to, e.g., javascript. No examples how this could be used were found on the web. The wiki page [6] is ineresting, but the required libraries cannot be found on Hackage anymore.

yc2js is available from haskell darcs (, but not on hackage. it contains examples of how Haskell code is translated to java; it seems superseeded by:

jsmv which is in Hackage and installs with cabal. The example code found on the web page run (helloWorld and calc). The code is quite complex and not exactly like ordinary Haskell; I could not apply an arbitrary function to a string the user has input and then put the result of the conversion (e.g. capitalize) back on screen.

Haskell code executed by web broswers

There is a new wiki page 'web' that describes and compares packages; the focus here is on how to use these from mobile devices. Two approaches can be separated:

Uses standard web server (e.g. Apache)

CGI based

Most web server understand the CGI interface and application can use it as an interface: The package cgi from hackage can be installed with cabal (the newest version of the code is however in a git repository [7]); Haskell code compiles to an executable which is moved to the cgi-bin directory of the server and then accessible from the web. Limiting for mobile devices is that the executable produced by ghc runs only on the hardware it is produced for (i.e. not a ARM based android mobile).

Uses special servers

WASH and similar

Packages like WashNGo etc. are tools to author web pages. see: [8]

The examples work, after precompilation with wash2hs; this allows to include web forms in the original form (with lots of <>). The result from precompilation are compiled with ghc and the executable copied to cgi-bin.


Most newer efforts do not only produce a server but a framework for application development, blending different tools which have been developed over the past years to simplify application development.

For example: Salivia ( gives a choice of different backends, including HTTP, CGI..

Alternatives outside of Haskell

Two solutions using languages which are relatively close to Haskell are:

O'Caml announced a compiler to javascript, which produces code which can be run on mobile devices. [9]

Lua is included in the Android Scripting Environment(

Optimal choice

Given that producing apps directly for the mobile device is not yet possible, the goal is to select a method which will make eventual conversion simple.


The page needs editing to add the references to the web pages.

I am currently working on producing web apps for mobile devices and interested to hear comments at frank at geoinfo dot tuwien dot ac dot at.

This category currently contains no pages or media.