#lang typed/racket (modulo 12 2)
#lang typed/racket (require typed/srfi/14) (char-set= (string->char-set "hello") (string->char-set "olleh"))
Other libraries can be used with Typed Racket via require/typed.
#lang typed/racket (require/typed version/check [check-version (-> (U Symbol (Listof Any)))]) (check-version)
The following libraries are included with Typed Racket in the typed collection:
Added in version 1.1 of package typed-racket-more.
Other libraries included in the main distribution that are either written in Typed Racket or have adapter modules that are typed:
To adapt a Racket library not included with Typed Racket, the following steps are required:
Determine the data manipulated by the library, and how it will be represented in Typed Racket.
Specify that data in Typed Racket, using require/typed and #:opaque and/or #:struct.
Use the data types to import the various functions and constants of the library.
Provide all the relevant identifiers from the new adapter module.
For example, the following module adapts the untyped racket/bool library:
#lang typed/racket (require/typed racket/bool [true Boolean] [false Boolean] [symbol=? (Symbol Symbol -> Boolean)] [boolean=? (Boolean Boolean -> Boolean)] [false? (Any -> Boolean)]) (provide true false symbol=? boolean=? false?)
More substantial examples are available in the typed collection.