Motivation

This library aims to make it easy for users to build native apps that work portably across platforms. I'm also very interested in the user interface renaissance in the programming community, whether the various kinds of functional reactive programming, meta-object protocol UIs, or something like React.js. The hope is that a low-cost, hassle-free way of getting a UI up and running without having to deal with browser, authentication, and compilation issues will make it more fun to play around with these great ideas using Haskell. Why a native toolkit? Even in this era of web interfaces, it is still useful to be able to make native apps. They are usually faster and have fewer security issues. Why FLTK? I chose FLTK because it was small enough that one person could bind the whole thing in an initial pass. Larger toolkits like QT, although much slicker, would require many man-years of effort.

FLTK is quite featureful.

FLTK is mature and maintained. The project is about 20 years old, and I have had good experiences with the community.

FLTK comes with a simple but quite useful GUI builder, Fluid which is now able to generate Haskell code. See the `Fluid Support` section for more details. What about HsQML/WxHaskell/Gtk2Hs? These are all great projects and produce really nice UIs, but they all fail at least one of criterion listed under the Goals section below. To my knowledge, as of the second quarter of 2017, no other package in the Haskell ecosystem meets all those constraints.

Goals

The goals of this library are to provide a low-level API to the FLTK that: provides full coverage of the toolkit allowing the user to write GUIs in pure Haskell. feels like it has polymorphic dispatch, meaning a single function dispatches to the right implementation based on the type of widget it is given. is not monolithic, meaning new widgets can be incorporated the user's application without needing to recompile this library. is easy to install. This library has a minimum of dependencies and FLTK itself compiles cleanly on most architectures. And now there is a bundled option where Cabal/Stack build FLTK for you behind the scenes. allows the user to produce statically linked binaries with a minimum of external dependencies. includes a lot of complete working demos so that you can get up and running faster. comes with GUI builder support to alleviate the tedium of laying out widgets by hand.

Obstacles

This section attempts to briefly highlight some possible dealbreakers users might want to know about before proceeding. To be clear, building and deploying portable static application binaries works well on all platforms which is why the library is considered usable. And most of these issues are being aggressively addressed but in the interests of full disclosure ... Look & Feel The default look of FLTK apps can be charitably described as retro. And FLTK has no support for theming since it was designed for the embedded domain and trades off slickness for speed, portability and binary size. But that doesn't mean the user is limited to the default! FLTK is quite flexible and it is pretty easy to change the way a widget looks and behaves, but there is no "theme file" that applies uniformly to all widgets in the app. Compile Times Currently a dense app with ~ 160-180 widgets crammed into the same window takes 9-12 seconds to compile with GHC 7.10.3 on a 32GB quad-core machine. The good news is that this is a known issue.

Installation

There are two ways to install FLTKHS, building with the bundled FLTK GUI library, or compiling and installing FLTK from scratch yourself. The bundled way is by far the easiest on all platforms. It is completely self-contained, you don't need any sudo access to your system.

Build With Bundled FLTK

Linux & *BSD

The steps are: Make sure to have OpenGL installed if you need it.

Ensure that make , autoconf and autoheader are available on your system.

, and are available on your system. Download & install Stack.

Download & install the FLTKHS hello world skeleton.

Verify the install by running `fltkhs-hello-world`. Download & Install Stack Pick the Stack installer that matches your distribution and install according to the instructions. Download & Install the FLTKHS Hello World Skeleton Downloading Without Git If git is not installed, download the latest version of the fltkhs-hello-world application skeleton from here. Extract and rename the archive: > tar -zxvf fltkhs-hello-world-master.tar.gz > mv fltkhs-hello-world-master fltkhs-hello-