The threepenny-gui package

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.



Threepenny-GUI is a GUI framework that uses the web browser as a display.

It's very easy to install because everyone has a web browser installed.

A program written with Threepenny is essentially a small web server that displays the user interface as a web page to any browser that connects to it. You can freely manipulate the HTML DOM and handle JavaScript events from your Haskell code.

Stability forecast: This is an experimental release! Send me your feedback! Significant API changes are likely in future versions.

NOTE: This library contains examples, but they are not built by default. To build and install the example, use the buildExamples flag like this

cabal install threepenny-gui -fbuildExamples

[Skip to ReadMe]


Dependenciesaeson (>=0.7 && <0.10 || ==0.11.* || >=1.0 && <1.2), async (>=2.0 && <2.2), base (>=4.6 && <4.11), bytestring (>=0.9.2 && <0.11), containers (>=0.4.2 && <0.6), data-default (>=0.5.0 && <0.8), deepseq (>=1.3.0 && <1.5), filepath (>=1.3.0 && <1.5.0), hashable (>=1.1.0 && <1.3), network (>=2.3.0 && <2.6), network-uri (==2.6.*), safe (==0.3.*), snap-core (>=0.9.0 && <1.1), snap-server (>=0.9.0 && <1.1), stm (>=2.2 && <2.5), template-haskell (>=2.7.0 && <2.12), text (>=0.11 && <1.3), threepenny-gui, time, transformers (>=0.3.0 && <0.6), unordered-containers (==0.2.*), vault (==0.3.*), vector (>=0.10 && <0.13), websockets (>=0.8 && <0.11), websockets-snap (>=0.8 && <0.11) [details]
AuthorHeinrich Apfelmus
MaintainerHeinrich Apfelmus <apfelmus at quantentunnel dot de>
CategoryWeb, GUI
Home page
Bug tracker
Source repositoryhead: git clone git://
Executablesthreepenny-examples-drummachine, threepenny-examples-dragndropexample, threepenny-examples-currencyconverter, threepenny-examples-crud, threepenny-examples-chat, threepenny-examples-canvas, threepenny-examples-buttons, threepenny-examples-bartab
UploadedWed Feb 1 06:37:46 UTC 2017 by sjakobi





Build example executables.


Get Network.URI from the network-uri package


The library uses some techniques that are highly non-deterministic, for example garbage collection and concurrency. Bugs in these subsystems are harder to find. Activating this flag will expose more of them.


Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info


Maintainers' corner

For package maintainers and hackage trustees

Readme for threepenny-gui-

[back to package description]

Build Status

Threepenny-gui is a GUI framework written in Haskell that uses the web browser as a display. It's very easy to install. See the

Project homepage

for more information on what it does and can do for you as a library user.


The library comes with many examples, which can be found in the samples folder. Follow the link for more information on how to run them.

Technical overview

A program written with Threepenny is essentially a small web server that displays the user interface as a web page to any browser that connects to it.


The frequent communication between browser and server means that Threepenny is best used as a GUI server running on localhost.

The communication is done over a persistent connection using WebSockets.

If you want to reduce latency, the best option is to generate JavaScript code and run it on the client. Consider this approach similar to a shading language. Some means of producing JavaScript from Haskell might be:

Alternatively, the JS can be written by the user directly and invoked via the JavaScript FFI from Threepenny.

Future ideas

HTML rendering mode

It might be nice in the case of search engines to merely generate a DOM and render it, so that search engines can read the pages.

UI libraries

qooxdoo — provides a feature-complete widget set. One could wrap this in a type-safe API from Threepenny and get a complete, stable UI framework for free. Most of the "immediate feedback" like dragging things here, switching tabs there, are taken care of by the framework. All that would be left would be to provide the domain configuration and business/presentation logic.

There are plenty more like this, but this is the first that springs to mind that is good.


Many thanks to everyone who contributed, provided feedback or simply wrote an application using Threepenny! In particular, many thanks to:

Heinrich Apfelmus, Daniel Austin, Steve Bigham, Ken Friis Larsen, Daniel Mlot, Tim C. Schröder and also Daniel Diaz, Alex Greif, Yuval Langer, JP Moresmau, Luke Palmer, Jens Peterson, Jaap van der Plas, rnons, Michael Snoyman, tailcalled

Special thanks to Chris Done for starting the precursor project Ji.