{"size": 1528, "ext": "scrbl", "max_stars_repo_path": "typed-racket-doc/typed-racket/scribblings/guide/quick.scrbl", "max_stars_repo_name": "SnapCracklePopGone/typed-racket", "max_stars_repo_stars_event_min_datetime": "2015-01-07T11:59:09.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-29T16:16:38.000Z", "max_issues_repo_path": "typed-racket-doc/typed-racket/scribblings/guide/quick.scrbl", "max_issues_repo_name": "Seanpm2001-Racket-lang/typed-racket", "max_issues_repo_issues_event_min_datetime": "2015-01-05T13:22:22.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-29T11:15:00.000Z", "max_forks_repo_path": "typed-racket-doc/typed-racket/scribblings/guide/quick.scrbl", "max_forks_repo_name": "Seanpm2001-Racket-lang/typed-racket", "max_forks_repo_forks_event_min_datetime": "2015-01-07T19:02:44.000Z", "max_forks_repo_forks_event_max_datetime": "2022-01-21T13:53:31.000Z"}
{"max_stars_count": 498, "max_issues_count": 977, "max_forks_count": 117, "avg_line_length": 26.8070175439, "max_line_length": 79, "alphanum_fraction": 0.6681937173}
#lang scribble/manual

@(require "../utils.rkt" (for-label (only-meta-in 0 typed/racket)))
@(provide typed-mod)

@title[#:tag "quick"]{Quick Start}

Given a module written in the @racketmodname[racket] language, using
Typed Racket requires the following steps:

@itemize[#:style
         'ordered
         @item{Change the language to @racketmodname[typed/racket].}
         @item{Change the uses of @racket[(require mod)] to
           @racket[(require typed/mod)].}
         @item{Annotate structure definitions and top-level
           definitions with their types.} ]

Then, when the program is run, it will automatically be typechecked
before any execution, and any type errors will be reported.  If there
are any type errors, the program will not run.

Here is an example program, written in the @racketmodname[racket]
language:

@(define typed-mod
@racketmod[
typed/racket
(struct pt ([x : Real] [y : Real]))

(: distance (-> pt pt Real))
(define (distance p1 p2)
  (sqrt (+ (sqr (- (pt-x p2) (pt-x p1)))
           (sqr (- (pt-y p2) (pt-y p1))))))
]
)

@racketmod[
racket
(struct pt (x y))

(code:contract distance : pt pt -> real)
(define (distance p1 p2)
  (sqrt (+ (sqr (- (pt-x p2) (pt-x p1)))
           (sqr (- (pt-y p2) (pt-y p1))))))
]

Here is the same program, in @racketmodname[typed/racket]:

@|typed-mod|

@section{Using Typed Racket from the Racket REPL}

It is possible to use Typed Racket from the Racket REPL. To do so, start Racket
with the following command line:
@commandline{racket -I typed/racket}
