The Typed Racket Guide

Sam Tobin-Hochstadt <samth@racket-lang.org>
and Vincent St-Amour <stamourv@racket-lang.org>

Typed Racket is a family of languages, each of which enforce that programs written in the language obey a type system that ensures the absence of many common errors. This guide is intended for programmers familiar with Racket. For an introduction to Racket, see the The Racket Guide.

    1 Quick Start

      1.1 Using Typed Racket from the Racket REPL

    2 Beginning Typed Racket

      2.1 Datatypes and Unions

      2.2 Type Errors

    3 Specifying Types

      3.1 Type Annotation and Binding Forms

        3.1.1 Annotating Definitions

        3.1.2 Annotating Local Binding

        3.1.3 Annotating Functions

        3.1.4 Annotating Single Variables

        3.1.5 Annotating Expressions

      3.2 Type Inference

      3.3 New Type Names

    4 Types in Typed Racket

      4.1 Basic Types

      4.2 Function Types

      4.3 Union Types

      4.4 Recursive Types

      4.5 Structure Types

      4.6 Subtyping

      4.7 Polymorphism

        4.7.1 Polymorphic Data Structures

        4.7.2 Polymorphic Functions

        4.7.3 Lexically Scoped Type Variables

      4.8 Variable-Arity Functions: Programming with Rest Arguments

        4.8.1 Uniform Variable-Arity Functions

        4.8.2 Non-Uniform Variable-Arity Functions

    5 Optimization in Typed Racket

      5.1 Turning the optimizer off

      5.2 Getting the most out of the optimizer

        5.2.1 Numeric types

        5.2.2 Lists

        5.2.3 Vectors

        5.2.4 Optimization Coaching