Getting Started

The Glasgow Haskell Compiler (GHC) is required to build, install, and run husk. All recent versions of GHC are supported, including 6.10, 7.0, 7.2, 7.4, and 7.6. The easiest way to get GHC is via the Haskell Platform, which also includes other required tools such as Cabal.

Once the Haskell Platform is installed, the recommended method to install Husk is to use Cabal:

cabal update cabal install husk-scheme

Before running husk you may also need to add the cabal executable directory to your path. On Linux this is ~/.cabal/bin.

Command Line Tools

The interactive interpreter may be invoked by running it directly from the command line:

huski

Alternatively, you may run an individual Scheme program:

huski my-scheme-file.scm

A compiler is also provided to allow you to create native executables:

huskc my-scheme-program.scm ./my-scheme-program

Libraries and Extensions

Husk supports most of the R5RS and R7RS standard libraries, as described in this manual.

The following SRFI libraries are supported:

  • SRFI 1: List Library - A comprehensive set of list-processing procedures. This library is not included by default, it must be loaded using (import (srfi 1)).
  • SRFI 2: and-let* - An and with local bindings, a guarded let* special form. This library is not included by default, it must be loaded using (import (srfi 2)).
  • SRFI 8: receive - Binding to multiple values.
  • SRFI 9: Defining record types.
  • SRFI 22: Running Scheme Scripts on Unix. See the example programs cat.scm and sum.scm in the source tree for demonstrations of how to write a husk script.
  • SRFI 23: Error reporting mechanism.
  • SRFI 28: Basic format strings.
  • SRFI 39: Parameter objects.
  • SRFI 55: require-extension - An extremely simple facility for making an extension or library available to a Scheme toplevel environment.
  • SRFI 69: Basic hash tables.

Finally, Husk also includes a set of custom libraries:

  • (husk pretty-print) formats Lisp code so that it may be printed in a clean and readable form.
  • (husk random) provides basic support for random number generation.

Macros

The Macros section provides an overview of the syntax-rules and explicit renaming systems provided by Husk. There is also a section on macro debugging with expand.
husk-scheme online documentation rev 3.2 (2021.03.04)