Personal tools

Category:Web/Mobile Applications

From HaskellWiki

< Category:Web(Difference between revisions)
Jump to: navigation, search
 
(Changed category from "Haskell" to "Web")
 
(2 intermediate revisions by one user not shown)
Line 1: Line 1:
= Mobile Web applications =
+
= Mobile Web Applications =
   
[[Category:Haskell]]
+
[[Category:Web]]
   
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'[ http://www.haskell.org/haskellwiki/Web] which discusses web related packages and an old, seriously outdated page 'practical web programming in Haskell' [http://www.haskell.org/haskellwiki/Practical_web_programming_in_Haskell])
+
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' [http://www.haskell.org/haskellwiki/Practical_web_programming_in_Haskell])
   
 
The ultimate goal is to produce web apps written in Haskell which run in any browser without installation (client-side web app [http://www.w3.org/TR/WAPF-REQ/]]; 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 ultimate goal is to produce web apps written in Haskell which run in any browser without installation (client-side web app [http://www.w3.org/TR/WAPF-REQ/]]; 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.
Line 15: Line 15:
 
- 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]
   
 
= Haskell code executed by web broswers =
 
= Haskell code executed by web broswers =
Line 57: Line 59:
 
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

Contents

[edit] 1 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:

[edit] 2 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:

[edit] 2.1 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]

[edit] 3 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:

[edit] 3.1 Uses standard web server (e.g. Apache)

[edit] 3.1.1 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).


[edit] 3.2 Uses special servers

[edit] 3.2.1 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.

[edit] 3.2.2 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..

[edit] 4 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).


[edit] 5 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.


[edit] 6 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.