Creator of GHCJS
YOW! Lambda Jam 2015 Brisbane
Heterogeneous Computation With Cloud Haskell and GHCJS
The objective of the workshop is to get some experience applying Haskell and GHCJS in a distributed systems setting for web applications. Familiarity with Haskell and Haskell development tools is assumed. A background in distributed systems, web development or prior experience with GHCJS is not required, but it is advisable to install GHCJS before the workshop. There will be help available for troubleshooting installation problems.
We will start with an introduction to event handling and document manipulation using GHCJS and work through some examples, giving everyone a chance to become familiar with the tools. Then we move on to GHCJS’ concurrency model and get our feet wet doing Cloud Haskell calls to the server.
After the introduction, we will work through two bigger examples. One is mainly compute-oriented: The client calls upon the server(s) for the heavy lifting but does its own share of the work to improve responsiveness. The other is data-oriented: We will focus on dealing with synchronization of state on the client and server, allowing the client to work with incomplete data and handle connection problems.
Skeleton code will be provided for all exercises. Fully worked out examples will be added to the ghcjs-examples repository after the workshop.
Heterogeneous computation with Cloud Haskell and GHCJS
In modern web applications, the client can do far more than simply showing data retrieved from the server. Clients are powerful enough to perform complex tasks without assistance from the server. The result is a greatly improved experience for the user: Network roundtrips can be avoided by local processing, improving responsiveness, and the application might remain usable even during intermittent loss of connectivity.
Bringing more responsibilities to the client requires the functionality to be duplicated for the browser environment. Additionally, to effectively deal with network latency and service interruptions, the application has to be designed around managing local state on the clients and effectively synchronizing this state with the server.
On some platforms, this would be a daunting task, requiring major chunks of code to be rewritten to make them work on the client. Fortunately, for Haskell we have GHCJS, allowing us to do everything from a single codebase. Haskell’s static type system and strong focus on purity and concurrency make it ideally suited for this type of application.
The talk will show how we can use Haskell and GHCJS to optimally distribute computations between the client and server, relying on Cloud Haskell for type-safe communication. The end result is a heterogeneous distributed system that decides where to perform computations depending on throughput and latency requirements and availability of data. Additionally we will explore how to work with local state on the client and what properties we need from our data structures for effectively dealing with synchronization.