On this page:
The Hackett Programming Language

The Hackett Programming Language

Alexis King <[email protected]>

WARNING: The contents of this manual are considered unstable, experimental, and subject to change; compatibility will not be maintained.

Hackett is a statically typed, pure, lazy, functional programming language in the Racket language ecosystem. Despite significant differences from #lang racket, Hackett shares its S-expression syntax and powerful, hygienic macro system. Unlike Typed Racket, Hackett is not gradually typed—it is designed with typed programs in mind, and it does not have any dynamically-typed counterpart.

This manual is divided into two parts: The Hackett Guide, which provides a gentler, tutorial-style overview of Hackett’s language features, and The Hackett Reference, a precise and authorative specification of the language and all of the forms and functions provided in the standard library.

For those new to Hackett, even those already familiar with languages similar to Hackett, like Racket or Haskell, it is highly recommended you start with The Hackett Guide. For the precise details of various language features, The Hackett Reference may be more appropriate. However, neither is intended to be read from beginning to end, in order: both sections are indexed and searchable as well as internally cross-referenced, and links are provided in the margins to jump to corresponding companion sections, when available.

    1 The Hackett Guide

      1.1 Quick Start

        1.1.1 Simple Definitions

      1.2 Hackett Essentials

        1.2.1 Infix Syntax

      1.3 Working with data

        1.3.1 Enumerations

        1.3.2 An introduction to lists

        1.3.3 Representing operations that can fail

      1.4 Partial Functions and Nontermination

    2 The Hackett Reference

      2.1 Core Syntactic Forms

        2.1.1 Type Annotation

        2.1.2 Definitions

        2.1.3 Anonymous Functions

        2.1.4 Local Bindings

        2.1.5 Pattern Matching

        2.1.6 Imports

      2.2 Datatypes

        2.2.1 Defining algebraic datatypes

        2.2.2 Numbers

        2.2.3 Strings

        2.2.4 Functions

        2.2.5 Quantification and Constrained Types

        2.2.6 Unit

        2.2.7 Booleans

        2.2.8 The Identity Type

        2.2.9 Tuples

        2.2.10 Optionals

        2.2.11 Lists

      2.3 Typeclasses

        2.3.1 Defining typeclasses and typeclass instances

        2.3.2 Printing for debugging

        2.3.3 Equality

        2.3.4 Semigroups and monoids

        2.3.5 Functors

        2.3.6 Applicative functors

        2.3.7 Monads

      2.4 I/O

      2.5 Monad Transformers

        2.5.1 Reader

        2.5.2 Error

      2.6 Controlling Evaluation

        2.6.1 Incomplete Programs