Yhc web service

From HaskellWiki
Jump to: navigation, search
Part of Yhc


Yhc Web Service


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.


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

document browser