Given a tr.rkt
like:
#lang typed/racket/base
(require plot/typed)
(plot (function vector-ref) 0 1) ;nonsense, but just for error message
You get something like:
$ racket tr.rkt
tr.rkt:8:16: Type Checker: type mismatch
expected: (-> Real Real)
given: (All (a)
(case-> (-> (Vectorof a) Integer a) (-> VectorTop Integer Any)))
in: vector-ref
context...:
/Users/greg/src/plt/racket/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/utils/tc-utils.rkt:125:12: for-loop
f44
/Users/greg/src/plt/racket/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/typecheck/tc-toplevel.rkt:249:0: type-check
/Users/greg/src/plt/racket/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/tc-setup.rkt:40:0: tc-setup
/Users/greg/src/plt/racket/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/typed-racket.rkt:25:4
standard-module-name-resolver
tr.rkt:8:0: Type Checker: could not apply function;
wrong number of arguments provided
expected: 1
given: 3
in: (plot (function vector-ref) 0 1)
context...:
/Users/greg/src/plt/racket/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/utils/tc-utils.rkt:125:12: for-loop
f44
/Users/greg/src/plt/racket/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/typecheck/tc-toplevel.rkt:249:0: type-check
/Users/greg/src/plt/racket/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/tc-setup.rkt:40:0: tc-setup
/Users/greg/src/plt/racket/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/typed-racket.rkt:25:4
standard-module-name-resolver
Type Checker: Summary: 2 errors encountered
context...:
/Users/greg/src/plt/racket/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/typecheck/tc-toplevel.rkt:249:0: type-check
/Users/greg/src/plt/racket/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/tc-setup.rkt:40:0: tc-setup
/Users/greg/src/plt/racket/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/typed-racket.rkt:25:4
standard-module-name-resolver
The actually useful part of that seems to be just:
tr.rkt:8:16: Type Checker: type mismatch
expected: (-> Real Real)
given: (All (a)
(case-> (-> (Vectorof a) Integer a) (-> VectorTop Integer Any)))
in: vector-ref
tr.rkt:8:0: Type Checker: could not apply function;
wrong number of arguments provided
expected: 1
given: 3
in: (plot (function vector-ref) 0 1)
Type Checker: Summary: 2 errors encountered
In other words the "context...:" sections are "stack traces" in Typed Racket implementation, seem to be "noise" that's n/a for the Typed Racket user?
Also, the TR errors seem to be printed directly to stderr. So it's imposible to intercept and customize them using error-display-handler
(which is a way to omit or at least trim the context for non-Typed Racket errrors).