Yhc web service

From HaskellWiki
Revision as of 03:48, 8 March 2008 by DimitryGolubovsky (talk | contribs) (User interface)
Jump to navigation Jump to search
Part of Yhc

(Download)

Yhc Web Service

Purpose

Yhc Web Service is a web-based tool to use Yhc's Javascript back end without installation of any additional software on user's computer. Only a standards-compilant web browser is needed. The service allows to submit some Haskell source code for compilation into Javascript, and generates a xhtml1 page which is temporarily stored. A link is provided to load the generated page into user's web browser. In general, Yhc web service's user interface is similar to one of a pastebin.

Hosting

The service is currently available at the following URL: http://www.golubovsky.org:5984/static/yhcws/MainGUI.html

Technical overview

Yhc Web Service is built around CouchDB which itself is written in Erlang. CouchDB uses JSON as encoding for queries and responses. A special daemon regularly polls the database for updates. If a new Haskell source is submitted for compilation as a new document, the daemon extracts it from the database, and invokes Yhc to transform it along with modules imported into linked Yhc Core. Next, Javascript Backend is invoked, to convert the linked Core into Javascript. Finally, using the XHTML template (user-supplied or standard), a Web page is built. Output from the compiler and other programs called during compilation is also collected. Results of compilation are stored in the database as attachments to the document which contains the submitted Haskell source.

The service runs a slightly modified version of SearchPath to chase imports across the Internet. This removes the limitation on the number of modules compiled simultaneously, while only one Haskell module may be submitted via user interface.

The Service runs under Linux inside a 32-bit virtual machine which is an instance of KVM administered by KVMADM on a 64-bit Linux host. Since CouchDB currently lacks any access control to its databases, Squid is used as reverse proxy with proper access control settings.

Users guide

User interface

Initially, the Service displays the following form in the web browser window. Each row of the form corresponds to a single pastebin entry. The links column contains icons that correspond to possible user actions that can be performed over each document. The author column identifies the submitter (author name is arbitrary: the Service does not authrnticate users). The time column shows the submission time (UTC). The title column shows the title that author gave to the entry. The status column shows whether the code submitted with the entry is being comipled, or that compilation was successful, or it failed.

document browser

The view Haskell source Hssrc.png icon is always present regardless of current status of an entry. Clicking on it shows the source code submitted with the entry. Clicking on the Close button restores the document browser.

source viewer

The view compilation log Log.png and view error log Error.png icons when clicked, show either the compilation log, or error log depending on success or failure of compilation. These icons appear only after compilation is complete (successful or failed). Similarly, the Close button restores the document browser.

log viewer

Clicking on the edit Edit.png icon opens the new entry form with the source of the corresponding entry. Thus, source code may be edited and resubmitted. The service does not keep track of source code revisions: each time source is edited, it is submitted as a new entry. This icon is always present with each entry.

new entry form

The view compiled page Webpage.png icon opens a new browser window where the compiled web page is loaded. This icon appears only after successful compilation.