On this page:
declare-refinement
Refinement
define-typed-struct/  exec
define-new-subtype
6.3

14 Experimental Features

These features are currently experimental and subject to change.

syntax

(declare-refinement id)

Declares id to be usable in refinement types.

syntax

(Refinement id)

Includes values that have been tested with the predicate id, which must have been specified with declare-refinement.

syntax

(define-typed-struct/exec forms ...)

Defines an executable structure.

syntax

(define-new-subtype name (constructor t))

Defines a new type name that is a subtype of t. The constructor is defined as a function that takes a value of type t and produces a value of the new type name. A define-new-subtype definition is only allowed at the top level of a file or module.

Examples:

> (module m typed/racket
    (provide Radians radians f)
    (define-new-subtype Radians (radians Real))
    (: f : [Radians -> Real])
    (define (f a)
      (sin a)))
> (require 'm)
> (radians 0)

0

> (f (radians 0))

0