Difference between revisions of "Yhc/Javascript"

From HaskellWiki
< Yhc
Jump to navigation Jump to search
(Mentioned a timer in Echo demo)
Line 29: Line 29:
 
|- valign="top"
 
|- valign="top"
 
|'''Haskell Source:'''||http://darcs.haskell.org/yhc/web/jsdemos/Echo.hs<br> http://darcs.haskell.org/yhc/web/jsdemos/Roman.hs (C) Malcolm Wallace
 
|'''Haskell Source:'''||http://darcs.haskell.org/yhc/web/jsdemos/Echo.hs<br> http://darcs.haskell.org/yhc/web/jsdemos/Roman.hs (C) Malcolm Wallace
  +
|-
  +
|'''Echo/Unicode'''
  +
|- valign="top"
  +
|'''Description:'''||Around March 20, 2007, handling of Unicode character properties was added to the Yhc/Javascript runtime. This implementation is based on the Unicode Character Database available from the [http://www.unicode.org Unicode Consortium]. The database was compiled in Javascript and included in the output web page. This demo program is just recompilation of the same source, but with the new runtime that supports Unicode.
  +
|- valign="top"
  +
|'''Features:'''||Same as in the above demo program. Replacement of functions like ''toUpper'', ''toLower'', ''isAlpha'' etc. to direct Javascript implementations affects the timing shown by the program: in some browsers there may be some speedup, in other browsers there may be a slowdown.
  +
|- valign="top"
  +
|'''Demo URL:'''||http://darcs.haskell.org/yhc/web/jsdemos/EchoUnicode.html
 
|}
 
|}
   

Revision as of 02:48, 20 March 2007

YCR2JS, a Converter of Yhc Core to Javascript

Table of Contents

  1. Brief Overview
  2. Users Guide
  3. Programmers Guide
  4. Inner Workings
  5. Examples and Demos
Echo
Description: Type any text in the input field provided, and see it echoed right above after Enter is pressed. Just for fun, type any decimal number and see it converted to a Roman number, and vice versa. For more fun, a timer is provided: measure how fast your browser runs Haskell ;)
Features: Lowest possible level of interaction with web browser:
  • Simple monadic framework
  • Wrapping Javascript functions to become Haskell functions
  • Calling Haskell functions from Javascript
  • Access to Javascript (including DOM) objects and properties
  • Handling of Javascript exceptions in Haskell
  • Events handling
  • Third party code of some "general" purpose works in web browser
Tested with: Netscape 7/Linux, MSIE 6.0/Windows 2000, Konqueror 3.5.5/Linux, Opera/Windows

feel free to add your own combination of browser/os where you got this demo working

Demo URL: http://darcs.haskell.org/yhc/web/jsdemos/Echo.html
Haskell Source: http://darcs.haskell.org/yhc/web/jsdemos/Echo.hs
http://darcs.haskell.org/yhc/web/jsdemos/Roman.hs (C) Malcolm Wallace
Echo/Unicode
Description: Around March 20, 2007, handling of Unicode character properties was added to the Yhc/Javascript runtime. This implementation is based on the Unicode Character Database available from the Unicode Consortium. The database was compiled in Javascript and included in the output web page. This demo program is just recompilation of the same source, but with the new runtime that supports Unicode.
Features: Same as in the above demo program. Replacement of functions like toUpper, toLower, isAlpha etc. to direct Javascript implementations affects the timing shown by the program: in some browsers there may be some speedup, in other browsers there may be a slowdown.
Demo URL: http://darcs.haskell.org/yhc/web/jsdemos/EchoUnicode.html


--DimitryGolubovsky 19:02, 6 November 2006 (UTC)