On this page:
The Typed Racket Reference
8.14.900

The Typed Racket Reference🔗ℹ

Sam Tobin-Hochstadt <samth@racket-lang.org>,
Vincent St-Amour <stamourv@racket-lang.org>,
Eric Dobson <endobson@racket-lang.org>,
and Asumu Takikawa <asumu@racket-lang.org>

This manual describes the Typed Racket language, a sister language of Racket with a static type-checker. The types, special forms, and other tools provided by Typed Racket are documented here.

For a friendly introduction, see the companion manual The Typed Racket Guide. For technical details, refer to the Bibliography.

 #lang typed/racket/base package: typed-racket-lib
 #lang typed/racket

    1 Type Reference

      1.1 Base Types

        1.1.1 Numeric Types

        1.1.2 Other Base Types

      1.2 Singleton Types

      1.3 Base Type Constructors and Supertypes

      1.4 Syntax Objects

      1.5 Control

      1.6 Other Type Constructors

      1.7 Other Types

    2 Special Form Reference

      2.1 Binding Forms

      2.2 Anonymous Functions

      2.3 Loops

      2.4 Definitions

      2.5 Structure Definitions

      2.6 Names for Types

      2.7 Generating Predicates Automatically

      2.8 Type Annotation and Instantiation

      2.9 Require

      2.10 Other Forms

      2.11 Special Structure Type Properties

    3 Libraries Provided With Typed Racket

      3.1 Porting Untyped Modules to Typed Racket

    4 Typed Classes

      4.1 Special forms

      4.2 Types

    5 Typed Units

      5.1 Special forms

      5.2 Types

      5.3 Interacting with Untyped Code

      5.4 Limitations

        5.4.1 Signature Forms

        5.4.2 Contracts and Unit Static Information

        5.4.3 Signatures and Internal Definition Contexts

        5.4.4 Tagged Signatures

        5.4.5 Structural Matching and Other Unit Forms

    6 Utilities

      6.1 Ignoring type information

      6.2 Untyped Utilities

    7 Exploring Types

    8 Deep, Shallow, and Optional Semantics

      8.1 Example Interactions

        8.1.1 Checking Immutable Data: Importing a List

        8.1.2 Checking Mutable Data: Importing a Vector

        8.1.3 Checking Functions that Cross Multiple Boundaries

      8.2 Forms that Depend on the Behavior of Types

        8.2.1 Example: Casts in Deep, Shallow, and Optional

      8.3 How to Choose Between Deep, Shallow, and Optional

        8.3.1 When to Use Deep Types

        8.3.2 When to Use Shallow Types

        8.3.3 When to Use Optional Types

        8.3.4 General Tips

      8.4 Related Gradual Typing Work

    9 Typed Racket Syntax Without Type Checking

    10 Typed Regions

    11 Optimization in Typed Racket

      11.1 Contract Optimization

    12 Unsafe Typed Racket operations

    13 Legacy Forms

    14 Compatibility Languages

    15 Experimental Features

      15.1 Logical Refinements and Linear Integer Reasoning

      15.2 Dependent Function Types

    Bibliography

    Index