Difference between revisions of "Hajax"

From HaskellWiki
Jump to navigation Jump to search
 
Line 4: Line 4:
   
 
* Native libraries/frameworks in JavaScript/HMTML/CSS. Examples being [http://www.dojotoolkit.org/ dojo] and [http://rialto.application-servers.com/wiki/ Rialto] (see the [http://dmoz.org/Computers/Programming/Languages/JavaScript/AJAX/ Open Directory Ajax page] for more).
 
* Native libraries/frameworks in JavaScript/HMTML/CSS. Examples being [http://www.dojotoolkit.org/ dojo] and [http://rialto.application-servers.com/wiki/ Rialto] (see the [http://dmoz.org/Computers/Programming/Languages/JavaScript/AJAX/ Open Directory Ajax page] for more).
 
 
* Higher-level languages that are compiled into JavaScript/HTML/CSS and/or Flash. Examples being the [http://code.google.com/webtoolkit Google Web Toolkit] for Java and [http://www.openlaszlo.org OpenLaszlo], for the high-level UI language Laszlo.
 
* Higher-level languages that are compiled into JavaScript/HTML/CSS and/or Flash. Examples being the [http://code.google.com/webtoolkit Google Web Toolkit] for Java and [http://www.openlaszlo.org OpenLaszlo], for the high-level UI language Laszlo.
   

Revision as of 23:18, 13 August 2006

Ajax applications are ‘stand-alone’ Web applications that execute into the browser environment, communicating with one or more server back-ends only to get raw data.

Ajax applications can be written using either:

  • Native libraries/frameworks in JavaScript/HMTML/CSS. Examples being dojo and Rialto (see the Open Directory Ajax page for more).
  • Higher-level languages that are compiled into JavaScript/HTML/CSS and/or Flash. Examples being the Google Web Toolkit for Java and OpenLaszlo, for the high-level UI language Laszlo.

Hajax is a proposal to create a Haskell-based tool to program Ajax applications.

The main advantages of Hajax would be:

  • Web development using a very-high level language with extensive compile-time checks
  • No plugins (e.g. a Java VM) required on the user browser
  • No Haskell server back-end required (Hajax applications would communicate with back-ends written in any language).

Likely disadvantages with respect to native Ajax solutions are:

  • An additional compilation step
  • Lower performance

Hajax would consist of the following modules:

  • A Haskell compiler able to generate, directly or indirectly, native browser code.
  • Generic Haskell libraries (a port of the existing standard Haskell Libraries)
  • User interface framework and libraries.
  • (Optionally) A development environment.

Compiler

Requirements:

  • Support for Haskell 98 + most popular extensions.
  • Fast compilation.
  • Compact and efficient compiled code.

Compiler Design alternatives

Direct Compilation

Haskell code is directly compiled to JavaScript.

Advantage: possibly higher run-time performance, thanks to a more direct mapping between Haskell and JavaScript.

An example of this approach is Dimitry Golubovsky’s nhc98 to JavaScript Compiler, see [1] and in particular [2].

Two-Stages Compilation

Haskell code is compiled into an intermediate format (bytecodes or C--) that is then compiled to JavaScript. For example: yhc to yhc bytecode to JavaScript (via the yhc bytecode API or similarly with GHCi bytecodes.

Advantage: much faster to develop as there would be less or no changes required in the compiler and the bytecode to JavaScript compilation should be straightforward.

Compiler Targets

Possible targets for the compiler are:

  • JavaScript/HTML/CSS
  • Flash
  • The OpenLaszlo kernel (currently under development) that can be executed in either Flash or HTML/Web browsers.

Generic Haskell Libraries

Libraries that would be useful include:

  • Prelude
  • Generic functional and mutable data structures
  • Parser/Regex libraries

UI Framework and Libraries

Most of the Haskell frameworks developed for GUI programming (see Libraries_and_tools/GUI_libraries) or Web programming (e.g. HSPClientside, see a full list at [[3]]) could be adapted for Hajax.

The libraries would include:

  • A complete set of UI widgets
  • Network libraries for browser-to-server communication

Development Environment

It should be relatively easy to adapt existing Haskell development environments like EclipseFP to work with Hajax.