Difference between revisions of "Category:Web/Mobile Applications"

From HaskellWiki
Jump to navigation Jump to search
(Changed category from "Haskell" to "Web")
 
Line 1: Line 1:
 
= Mobile Web Applications =
 
= Mobile Web Applications =
   
[[Category:Haskell]]
+
[[Category:Web]]
   
 
Programming of web applications for mobile devices in Haskell would be awesome - especially if these would even function, perhaps with limited functionality, when not connected to the internet. Tools like couchDB with its replication strategy makes this quite achievable. Unfortunately that seems not quite possible today:
 
Programming of web applications for mobile devices in Haskell would be awesome - especially if these would even function, perhaps with limited functionality, when not connected to the internet. Tools like couchDB with its replication strategy makes this quite achievable. Unfortunately that seems not quite possible today:
Line 17: Line 17:
 
- porting a Haskell compiler to the device or using a cross compiler; there is some progress to produce a ghc version fro Maemo ([http://hackage.haskell.org/trac/ghc/wiki/ArmLinuxGhc]);
 
- porting a Haskell compiler to the device or using a cross compiler; there is some progress to produce a ghc version fro Maemo ([http://hackage.haskell.org/trac/ghc/wiki/ArmLinuxGhc]);
   
- 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 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:
+
- compiling Haskell to JavaScript; several project are found on Hackage:
   
== Haskell to Javascript ==
+
== Haskell to JavaScript ==
The effort to use the York Haskell compiler and its intermediate code to produce javascript was started 2006 [http://haskell.org/haskellwiki/Yhc/Javascript]. In 2010 it seems mostly abandoned:
+
The effort to use the York Haskell compiler and its intermediate code to produce JavaScript was started 2006 [http://haskell.org/haskellwiki/Yhc/JavaScript]. In 2010 it seems mostly abandoned:
   
Yhc can be downloade from hackage, but i could not get it compiled [http://www.haskell.org/haskellwiki/Yhc/Building]; it seems that some parts are missing, especially the run time environment yhi -- but perhaps just some more instructions would make it work.
+
Yhc can be downloaded from hackage, but i could not get it compiled [http://www.haskell.org/haskellwiki/Yhc/Building]; 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 [http://www.haskell.org/haskellwiki/Haskell_in_web_browser] is ineresting, but the required libraries cannot be found on Hackage anymore.
+
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 [http://www.haskell.org/haskellwiki/Haskell_in_web_browser] is interesting, but the required libraries cannot be found on Hackage anymore.
   
yc2js is available from haskell darcs (http://code.haskell.org/yc2js/), but not on hackage. it contains examples of how Haskell code is translated to java; it seems superseeded by:
+
yc2js is available from Haskell Darcs (http://code.haskell.org/yc2js/), but not on hackage. it contains examples of how Haskell code is translated to Java; it seems superseded 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.
 
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.
   
a new (2010) approach is jmacro, which is a tool to help write javascript in a more Haskellish fashion. [http://www.haskell.org/haskellwiki/Jmacro]
+
a new (2010) approach is jmacro, which is a tool to help write JavaScript in a more Haskellish fashion. [http://www.haskell.org/haskellwiki/Jmacro]
   
 
= Haskell code executed by web broswers =
 
= Haskell code executed by web broswers =
Line 61: Line 61:
 
Two solutions using languages which are relatively close to Haskell are:
 
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. [http://code.google.com/p/ocamljs/w/list]
+
O'Caml announced a compiler to JavaScript, which produces code which can be run on mobile devices. [http://code.google.com/p/ocamljs/w/list]
   
 
Lua is included in the Android Scripting Environment(http://google-opensource.blogspot.com/2009/06/introducing-android-scripting.html).
 
Lua is included in the Android Scripting Environment(http://google-opensource.blogspot.com/2009/06/introducing-android-scripting.html).

Latest revision as of 13:40, 14 April 2013

Mobile Web Applications

Programming of web applications for mobile devices in Haskell would be awesome - especially if these would even function, perhaps with limited functionality, when not connected to the internet. Tools like couchDB with its replication strategy makes this quite achievable. Unfortunately that seems not quite possible today:

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'[ http://www.haskell.org/haskellwiki/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 downloaded 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 interesting, but the required libraries cannot be found on Hackage anymore.

yc2js is available from Haskell Darcs (http://code.haskell.org/yc2js/), but not on hackage. it contains examples of how Haskell code is translated to Java; it seems superseded 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.

a new (2010) approach is jmacro, which is a tool to help write JavaScript in a more Haskellish fashion. [7]

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 [8]); 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: [9]

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.

Frameworks

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 (http://hackage.haskell.org/package/salvia) 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. [10]

Lua is included in the Android Scripting Environment(http://google-opensource.blogspot.com/2009/06/introducing-android-scripting.html).


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.


Coda

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.