#

More Built-In Types

Typed Scheme comes with a number of other types and type constructors, corresponding (mostly) to primitive types provided by PLT Scheme.

The base types represent primitive data

`number`

Any number`str`

A string`symbol`

A symbol`boolean`

Either`#t`

or`#f`

`keyword`

A PLT Scheme literal keyword`top`

Any value

The following constructors are parameteric in a single type argument

`(Listof t)`

Homogenous lists of`t`

`(Vectorof t)`

Homogenous vectors of`t`

`(Option t)`

Either`t`

or`#f`

`(cons s t)`

is the pair containing`s`

as the`car`

and`t`

as the`cdr`

`(dom ... -> rng)`

is the type of functions from the (possibly-empty) sequence`dom ...`

to the`rng`

type.`(dom ... rst .. -> rng)`

is the type of functions from the (possibly-empty) sequence`dom ...`

with an optional trailing sequence of`rst`

to the`rng`

type. Note:`..`

is a part of the syntax of these types.`(U t ...)`

is the union of the types`t ...`

`(case-lambda fun-ty ...)`

is a function that behaves like all of the`fun-ty`

s. The`fun-ty`

s must all be function types constructed with`->`

.`(t t1 t2 ...)`

is the instantiation of the parametric type`t`

at types`t1 t2 ...`

`(pred t)`

is a predicate for type`t`

`(All (v ...) t)`

is a parameterization of type`t`

, with type variables`v ...`

`(values t ...)`

is the type of a sequence of multiple values, with types`t ...`

. This can only appear as the return type of a function.`v`

where`v`

is a number, boolean or string, is the singleton type containing only that value`i`

where`i`

is an identifier can be a reference to a type name or a type variable

Other types cannot be written by the programmer, but are used internally and may appear in error messages.

`#<struct:n (t ...)>`

is the type of structures named`n`

with field types`t`

. There may be multiple such types with the same printed representation.`(mu n t)`

is a recursive type where`n`

is bound to the recursive type in the body`t`

`<n>`

is the printed representation of a reference to the type variable`n`