diff --git a/typed-racket-doc/typed-racket/scribblings/reference/experimental.scrbl b/typed-racket-doc/typed-racket/scribblings/reference/experimental.scrbl index fda49f8f..c4eb8312 100644 --- a/typed-racket-doc/typed-racket/scribblings/reference/experimental.scrbl +++ b/typed-racket-doc/typed-racket/scribblings/reference/experimental.scrbl @@ -1,8 +1,13 @@ #lang scribble/manual -@begin[(require "../utils.rkt") +@begin[(require "../utils.rkt" scribble/eval) (require (for-label (only-meta-in 0 [except-in typed/racket for])))] +@(define the-top-eval (make-base-eval)) +@(define-syntax-rule (ex . args) + (examples #:eval the-top-eval . args)) + + @title{Experimental Features} These features are currently experimental and subject to change. @@ -15,3 +20,20 @@ predicate @racket[id], which must have been specified with @racket[declare-refinement].} @defform[(define-typed-struct/exec forms ...)]{Defines an executable structure.} + +@defform[(define-new-subtype name (constructor t))]{ +Defines a new type @racket[name] that is a subtype of @racket[t]. +The @racket[constructor] is defined as a function that takes a value of type +@racket[t] and produces a value of the new type @racket[name]. +A @racket[define-new-subtype] definition is only allowed at the top level of a +file or module. +@ex[(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) + (f (radians 0))] +} diff --git a/typed-racket-doc/typed-racket/scribblings/reference/special-forms.scrbl b/typed-racket-doc/typed-racket/scribblings/reference/special-forms.scrbl index ea1bc8a6..d47242a8 100644 --- a/typed-racket-doc/typed-racket/scribblings/reference/special-forms.scrbl +++ b/typed-racket-doc/typed-racket/scribblings/reference/special-forms.scrbl @@ -465,25 +465,6 @@ the type: (define-type Bar (U Bar False))] } -@section{Defining New Subtypes} - -@defform[(define-new-subtype name (constructor t))]{ -Defines a new type @racket[name] that is a subtype of @racket[t]. -The @racket[constructor] is defined as a function that takes a value of type -@racket[t] and produces a value of the new type @racket[name]. -A @racket[define-new-subtype] definition is only allowed at the top level of a -file or module. -@ex[(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) - (f (radians 0))] -} - @section{Generating Predicates Automatically} @defform[(make-predicate t)]{