6.4
3 Libraries Provided With Typed Racket
The typed/racket language corresponds to the
racket language—that is, any identifier provided
by racket, such as modulo, is available by default in
typed/racket.
The typed/racket/base language corresponds to the
racket/base language.
Some libraries have counterparts in the typed
collection, which provide the same exports as the untyped versions.
Such libraries include srfi/14,
net/url, and many others.
Other libraries can be used with Typed Racket via
require/typed.
The following libraries are included with Typed Racket in the
typed collection:
Describe a GIF stream, as produced by
gif-start
and accepted by the other functions from
file/gif.
Type alias for a list of three-element (R,G,B) vectors representing an image.
Describes an HTTP cookie as implemented by
net/cookie.
Describes an open FTP connection.
Describes an HTTP connection, corresponding to
http-conn?.
Describes an IMAP connection.
Describes exceptions raised by URL-related functions; corresponds
to
url-exception?.
Like PortT, but describes the functions that make POST and PUT
requests, which require an additional byte-string argument for POST or PUT
data.
Describes an SSL protocol, defined as
(U 'auto 'sslv2-or-v3 'sslv2 'sslv3 'tls 'tls11 'tls12).
Describes an OpenSSL server or client context.
Supertype of OpenSSL server and client contexts.
Describes an SSL listener, as produced by
ssl-listen.
Added in version 1.1 of package typed-racket-lib.
Describes a character set usable by the
srfi/14 functions.
Describes a cursor for iterating over character sets.
Describes an SRFI 19 time or date structure.
In some cases, these typed adapters may not contain all of exports of the
original module, or their types may be more limited.
Other libraries included in the main distribution that are either
written in Typed Racket or have adapter modules that are typed:
3.1 Porting Untyped Modules to Typed Racket
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:
More substantial examples are available in the typed
collection.