MyNixOS website logo
Description

FLTKHS demos. Please scroll to the bottom for more information.

FLTKHS demos moved to a separate package to keep the core package free of additional dependencies.

fltkhs-demos

These are end-to-end demos of [FLTKHS] 1, a Haskell Binding to the FLTK GUI Library

Fltkhs-demos aims not only to show off the features of the [fltkhs] 1 but also serve as a way of learning the API by example. For more thorough documentation on the [fltkhs] 1 API please see the [FLTKHS module] 2 of that package.

Introduction

The demos shipped with this package are listed in fltkhs-demos.cabal as separate Executable components. Once the package is installed they are installed to a location known to Stack, so to execute fltkhs-arc for instance do:

> stack exec fltkhs-arc

Note that all the executables are prefixed with "fltkhs-". This is in order to prevent the demo executables from stomping over applications of the same name the user might already have installed. Typing:

 > fltkhs-<TAB>

at the command line should show a complete list of available demos.

Learning The API

Most of the demos are exact ports of those shipped in the 'test' directory of the FLTK distribution. It is hoped the user will study the Haskell demo code side-by-side with the C++ demo code in order to understand the API. The section API Guide in the [FLKTHS documentation] 2 covers this in more detail.

Why is the demo code so un-Haskelly?

For being written in Haskell, the demo code is horrifyingly/amazingly imperative and stateful. Although it may repulse those who used to pure Haskell idioms it is that way for a reason.

The demo code was never meant to be idiomatic Haskell code but a way of showing as much of the API as possible. The API itself closely resembles the underlying C++ code which is imperative and stateful. This has the advantage of making the API easier to learn.

For instance, assuming FLTK was installed from source compare /src/Examples/arc.hs with /test/arc.cxx in the FLTK source directory. There is quite a bit of correspondence and it is easy to see how the Haskell API functions map to the C++ ones.

Fast Compilation Flag

This package comes with a flag fastCompile that is enabled by default and speeds up compilation. More information on this flag is available under the Compilation section of the [FLTKHS documentation] 2.

To disable this flag, tell Stack to ignore it during the configure step:

stack build --flag fltkhs-demos:-fastCompile

GHCi

Please see "Running In The Repl" 5 section of the FLTKHS documentation for more information.

Metadata

Version

0.0.0.7

License

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows